Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以进行比较每个文档的属性的查询?
例如:
收藏:
{ a b }
询问:
Collenction.find({ {a: { $lt: b}}).exec...
collection.find({ $where : "this.a < this.b" })
此查询不高效。或者在插入文档时,根据 (a < b ) 或 ( b < a ) 插入一个布尔值 true/false 并查询该布尔值。