mongodb query subset of an array

后端 未结 3 1256
清酒与你
清酒与你 2021-02-06 10:03

I have a field _keywords which is an array of strings. I want to get documents of which _keywords are super-set of the query array.

For example

3条回答
  •  隐瞒了意图╮
    2021-02-06 10:53

    In MongoDb, for array field:

    "$in:[...]" means "intersection" or "any element in",
    "$all:[...]" means "subset" or "contain",
    "$elemMatch:{...}" means "any element match"
    "$not:{$elemMatch:{$nin:[...]}}" means "superset" or "in"
    

提交回复
热议问题