Is it possible to cast in a MongoDB-Query?

You can use the following JavaScript expression:

db.test.find("this.value > 12")

This uses JavaScript's automatic conversion from string to number.


I have a similar workaround, i find that if you can use the mongo shell, you can write an statement to do this in javascript, but capable of using indexes.

var myItems = []
var it = db.test.find({},{value:1})
while (it.hasNext()){
 var item = it.next();
 if(parseInt(item.value) > 12)
  myItems.push(item);
}

If you want this to run faster than previus solution, you have to ensure the index on the value field.