2014-07-01 88 views
2

在MongoDB中我不得不放弃或WHERE子句MongoDB的多重条件在WHERE子句

我是初学者条件。我不知道如何实现这个目标?

DELETE FROM tablename WHERE id = 6 OR id =8 

什么是在MongoDB中的类似查询?

+1

您是否试过阅读...文档? – Sammaye

+1

Google是你的朋友:http://docs.mongodb.org/manual/reference/sql-comparison/ –

回答

3

只需使用$或操作符here即可。

db.tablename.remove({ $or: [ { _id: 6 }, { _id: 8 } ] }) 

您也可以在手册中找到SQL comparison的相应章节。