【发布时间】:2014-01-05 06:42:42
【问题描述】:
我有一个数组,它是 Mongodb 的过滤器。 但它不起作用,我不明白为什么。
Array
(
[deleted] => Array
(
[$ne] => 1
)
[public] => 1
[_id] => Array
(
[$nin] => Array
(
[0] => MongoId Object
(
[$id] => 525becec38aa9e28201f1d68
)
[1] => MongoId Object
(
[$id] => 525becb438aa9e963a1f1d55
)
[2] => MongoId Object
(
[$id] => 525bec7438aa9e8d3a1f1d56
)
[3] => MongoId Object
(
[$id] => 525bec1438aa9e6c6d1f1d69
)
[4] => MongoId Object
(
[$id] => 525bebcf38aa9e8c3a1f1d57
)
[5] => MongoId Object
(
[$id] => 525beb3038aa9e8d3a1f1d55
)
)
)
)
我需要找到标识符不在列表中的所有对象。
【问题讨论】:
-
那是什么编程语言?我认为它可能是 PHP,但我不确定。请添加适当的标签。
-
我不明白你在做什么。请更具体,并向我们展示您已经尝试过的内容。 MongoDB 查询需要做什么?
-
我正在尝试获取不包含在列表中的所有对象,数组中的列表 $nin if( !empty( $profile['answered'] ) ) $filter['_id ']['$nin'][] = $profile['已回答']; if( !empty( $profile['wrongAnswered'] ) ) $filter['_id']['$nin'] = $profile['wrongAnswered']; $object = $this->mongo->questions->find( $filter )->limit(1)->sort( array( 'gallery.0' => -1 ) );