How do I do a “NOT IN” query in Mongo?

前端 未结 4 1273
花落未央
花落未央 2020-11-28 10:15

This is my document:

{ 
    title:\"Happy thanksgiving\",
    body: \"come over for dinner\",
    blocked:[
       {user:333, name:\'john\'},
       {user:99         


        
4条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-28 10:58

    You can use $in or $nin for "not in"

    Example ...

    > db.people.find({ crowd : { $nin: ["cool"] }});
    

    I put a bunch more examples here: http://learnmongo.com/posts/being-part-of-the-in-crowd/

提交回复
热议问题