删除集合mongodb上的一行

时间:2015-05-06 19:33:39

标签: php mongodb

我有这个集合

{ "_id" : ObjectId("554a4aee0faaf2a804b7acd9"), "text" : "bla;", "comment_name" : "test1", "comment_email" : "test@hotmail.fr", "article" : { "_id" : NumberLong(4) } }
{ "_id" : ObjectId("554a4ba90faaf2a604b7acd9"), "text" : "hey", "comment_name" : "test2", "comment_email" : "tes2t@hotmail.fr", "article" : { "_id" : NumberLong(4) } }

我想删除一行:

> db.comments_4.( { "comment_name" : "test2" })

我有这个错误

  

2015-05-06T20:17:24.198 + 0200 E QUERY语法错误:意外的令牌   (

1 个答案:

答案 0 :(得分:0)

在访问comments_4集合之后,您缺少函数名称“remove”。

db.comments_4.remove({"comment_name" : "test2" })

希望它有所帮助!