演算子と JavaScript 式を使用$where
して、クエリ ロジックを記述できます。
http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-JavascriptExpressionsand%7B%7B%24where%7D%7D
> db.newColl.find()
{ "_id" : ObjectId("4fbdcdd6e79d66d9e681b185"), "time1" : 123, "time2" : 22 }
{ "_id" : ObjectId("4fbdcddee79d66d9e681b186"), "time1" : 11, "time2" : 220 }
{ "_id" : ObjectId("4fbdcde6e79d66d9e681b187"), "time1" : 331, "time2" : 2120 }
{ "_id" : ObjectId("4fbdcdece79d66d9e681b188"), "time1" : 1, "time2" : 20 }
> db.newColl.find({'$where' : 'this.time1 > this.time2' });
{ "_id" : ObjectId("4fbdcdd6e79d66d9e681b185"), "time1" : 123, "time2" : 22 }
> db.newColl.find({'$where' : 'this.time1 < this.time2' });
{ "_id" : ObjectId("4fbdcddee79d66d9e681b186"), "time1" : 11, "time2" : 220 }
{ "_id" : ObjectId("4fbdcde6e79d66d9e681b187"), "time1" : 331, "time2" : 2120 }
{ "_id" : ObjectId("4fbdcdece79d66d9e681b188"), "time1" : 1, "time2" : 20 }