0

我想在数组中搜索一个值

`[_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)));

4

1 回答 1

0
db.collection.find({"metadata.user.root":7})

如果我理解你的问题,这应该有效。

于 2013-02-28T07:01:52.480 回答