DEV Community

San
San

Posted on

You can convert the string field to int and then compare. If the db value is in sting

You can convert the string field to int and then compare.

If aggregation add a match stage

{"$match" : {"$expr" : {"$gt" : [{"$toInt" :"$diskSizeGb"} , 200]}}}
If find

find({"$expr" : {"$gt" : [{"$toInt" :"$diskSizeGb"} , 200]}})
*$expr allows us to use aggregate operators to query

Top comments (0)