Or 或操作

SELECT * FROM test
WHERE (name LIKE '%star%' AND NOT name LIKE '%trek%') OR duration = 200

db.test.find({$or:
    [
      { name: /star/i, name: { $not: /trek/i } },
      { duration: 200 }
    ]
  },{_id:0})

 

你可能感兴趣的:(操作)