Is it possible to cast in a MongoDB-Query?

前端 未结 5 1293
醉梦人生
醉梦人生 2020-12-01 18:13

When I have two MongoDB documents like this...

db.test.insert( {\"value\" : \"10123\"} );
db.test.insert( {\"value\" : \"160\"} );

The resu

5条回答
  •  渐次进展
    2020-12-01 18:41

    You can use the following JavaScript expression:

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

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

提交回复
热议问题