我想搜索数组中的值,如
`[_id] => MongoId Object (
[$id] => 511f4ce622efc34f15000001
)
[metadata] => Array (
[filename] => 6410-funny_face.gif
[parrent] => myfolder/newfolder2
[user] => Array ( >>>>>>>> i need to fetch all users
[root] => 7
[admin] => 7
[user] => 0
)
[group] => Array (
[23] => 2
)
)
[filename] => 6410-funny_face.gif
[uploadDate] => MongoDate Object (
[sec] => 1361005798
[usec] => 799000
)
[length] => 3083
[chunkSize] => 262144
[md5] => eb3846f78f461165e5bf59a05707edd1`
我需要在PHP或MongoShell中找到用户的密钥和值
我正在使用db.collection.find(array(metadata.filename: 6410-funny_face.gif));
给出了正确答案,但在查找db.collection.find(array(metadata.user: array(7)));
答案 0 :(得分:0)
db.collection.find({"metadata.user.root":7})
如果我理解你的问题,这应该有效。