mongo根據數組長度查詢

原文:https://www.itranslater.com/qa/details/2105880015459058688

https://stackoverflow.com/questions/7811163/query-for-documents-where-array-size-is-greater-than-1

 

({"ids":{"$exists":true, "$ne":[], "$not":{"$size":1}}})

({$expr:{$gt:[{$size:"$ids"}, 1]}})

({'ids.1': {$exists: true}})

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章