I am using ReactiveMongo, I want to create a query that performs like query with numbers (BigDecimal) in MongoDB. For eg: whole number like 4321.3456
should be matched by 4321.34
.
The following 2 queries work on MongoShell to achieve this:
db.employee.find({"$where":"/^4321.34.*/.test(this.salary)"})
db.collection.find({
"$where": function() {
return Math.round(this.salary * 100)/ 100 === 1.12;
}
})
But, I couldn't find a way to perform this query using ReactiveMongo.
How can I execute such queries using ReactiveMongo ?
UPDATE
I have tried following query
val filter=Json.obj("$where" -> """/^4321.34.*/.test(this.salary)"""))
collection.find(filter).cursor[JsObject]()