我试图找出是否可以使用带数组的列查询文档。
但是如果可能的话,这些值是互换的。是否可以搜索数组
没有正确排序值?因为我稍后会使用这个参数
更新upsert。
如果我这样做,它会起作用:
players:[ "1","2"]
但如果我这样做,则返回零:
players:["2","1"]
文件:
{
"_id" : ObjectId("58218b1709896dabcef00cff"),
"players" : [
"1",
"2"
],
"total_games" : 1,
"stats" : [
{
"player_id" : "1",
"wins" : 0
},
{
"player_id" : "2",
"wins" : 0
}
]
}
查询(返回1):
db.getCollection('head_to_head_stats').find({players:[ "1","2"]})
查询(返回0):
db.getCollection('head_to_head_stats').find({players:[ "2","1"]})