MongoDB查询以查找FirstName和LastName的字段组合?
以下是要查询的字段组合查询-
> db.demo502.aggregate( ... [ ... { "$redact": { ... "$cond": [ ... { "$eq": [ ... { "$concat": [ "$FirstName", " ", "$LastName" ] }, ... "John Doe" ... ]}, ... "$$KEEP", ... "$$PRUNE" ... ] ... }} ... ] ... )
这将产生以下输出-
{ "_id" : ObjectId("5e875543987b6e0e9d18f56f"), "FirstName" : "John", "LastName" : "Doe" }