认为你可以在MongoDB上给我你的帮助。
我的计划是例如:
Array
(
[_id] => MongoId Object
(
[$id] => 538339ef5b17848a488b7e35
)
[group_name] => 'group 1'
[activity] => Array
(
[open] => Array
(
[company] => Array
(
[0] => Array
(
[name] => company 1
[date] => MongoDate Object
(
[sec] => 1400081160
[usec] => 0
)
),
[0] => Array
(
[name] => company 2
[date] => MongoDate Object
(
[sec] => 1500081160
[usec] => 0
)
),
[0] => Array
(
[name] => company 3
[date] => MongoDate Object
(
[sec] => 1600081160
[usec] => 0
)
),
[0] => Array
(
[name] => company 4
[date] => MongoDate Object
(
[sec] => 1700081160
[usec] => 0
)
)
)
)
)
)
Array
(
[_id] => MongoId Object
(
[$id] => 538339ef5b178424498b7e34
)
[group_name] => 'group 2'
[activity] => Array
(
[open] => Array
(
[company] => Array
(
[0] => Array
(
[name] => company 3
[date] => MongoDate Object
(
[sec] => 1300081160
[usec] => 0
)
),
[0] => Array
(
[name] => company 1
[date] => MongoDate Object
(
[sec] => 1600081160
[usec] => 0
)
),
[0] => Array
(
[name] => company 2
[date] => MongoDate Object
(
[sec] => 1800081160
[usec] => 0
)
),
[0] => Array
(
[name] => company 4
[date] => MongoDate Object
(
[sec] => 1900081160
[usec] => 0
)
)
)
)
)
)
事实上,只有当DATE的此类下单是“公司1,公司2,公司3”时,我才会填写“groupname”。 所以通常它应该在上面的例子中仅显示“Group 1”,因为订单是按照要求,而在“Group 2”订单中以“Business 3,然后是Company 1 ...”开头。
-
例如,如果我看起来像这样:
[activity.open.company] => Array
(
[$in] => Array
(
[0] => company 1
[1] => company 2
[2] => company 3
)
)
这将突出我的整个世界,而不仅仅是“第一组”
-
真诚地感谢您的帮助!
PS:对不起我的英语,我是法国人。
答案 0 :(得分:0)
当您使用$in
子句进行查询时,它基本上变为和$or
对应给定数组的项目。您编写的的查询与列出的两个文档相匹配,因为它们中至少包含公司2。