我有一个这样的mongoDB设置:
fieldName: {
"1": {
client: "name-here",
subfield: "more-junk-here"
},
"2": {
client: "another-client-name-here",
subfield: "more-data"
},
"3": {
client: "client-num-3",
subfield: "i-like-turkey-sandwiches"
}
}
如何查询“i-like-turkey-sandwiches”,而不知道它在第 3 位,也不搜索整个文档?我开始写这个,但我完全不知道如何进行搜索......
$cursor = $collection->findOne(array('fieldName' => 'i-like-turkey-sandwiches));