{
'a': 1,
'b':2,
'c': 3,
'd': [
{'e': 4, 'f': 5, 'g': 6},
{'e': 0, 'f': '', 'g': 3},
{'e': 1, 'f': '', 'g': 3},
]
}
{
'a': 1,
'b':2,
'c': 3,
'd': [
{'e': 4, 'f': '', 'g': 6},
{'e': 0, 'f': '', 'g': 3},
{'e': 1, 'f': '', 'g': 3},
]
}
这样的记录,问题是怎么获取d数组中f都为空的文档(如上的结果是文档2)?谢谢
I only know how to implement this using
$where
, I don’t know about other methods yet.
——————————————————————————————Excerpted from "The Authoritative Guide to Mongodb (E2)"注意
Tested it on mongo shell: