I am trying to perform an aggregation query on a collection. I want to divide 2 of the fields and check if this is less than a certain value.
The way this db was made, it has all the fields as strings, and this isn't something I can really change right now. I wondered if there was a way to cast the values as numbers, maybe using $let or something?
As it is I currently get the error
exception: $divide only supports numeric types, not String and String
This is an example of the sort of query I am trying to run:
db.myCollection.aggregate([{
"$project": {
"mins": {
"$divide": ["$ALOWOVRLTOTL", "$FEESCALLCOST"]}
}
},
"$match": {
"mins": {
"$lte": 40
}
}
}])