2024-06-16 10:44:31 发布
网友
我有这样的收藏:
user_id albums 1 [1 2 3 4] 2 [3 5 7 8]
我想找出所有的唱片,相册里有3,7或8,我写的代码是这样的,但不起作用:
正确的方法是什么?在
试试这个
collection1.find({'albums': {'$in': [3, 7, 8]}})
从mongodb文档中,[IN] allow[s] you to specify an array of possible matches
[IN] allow[s] you to specify an array of possible matches
如果这不起作用,也许可以回溯并查看集合中37和{}的实际类型,以确保它们是int。在
3
7
试试这个
从mongodb文档中,
[IN] allow[s] you to specify an array of possible matches
如果这不起作用,也许可以回溯并查看集合中}的实际类型,以确保它们是int。在
^{pr2}$3
7
和{相关问题 更多 >
编程相关推荐