Wednesday, February 26, 2014

Mongo 2.4.9 - comparison of two fields

- example of a document

{ "_id" : ObjectId("5302f29ad7945f76575d2c75"), "a" : 2, "b" : 1 }

- CRUD

db.test.aggregate({$project:{a:1,b:1,isTrue:{$gt:['$a','$b']}}},{$match:{isTrue:true}})

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.