【问题标题】:mongoDB - db.collection.remove by _id just outputsmongoDB - db.collection.remove by _id 只是输出
【发布时间】:2016-05-11 13:43:19
【问题描述】:

我正在尝试从我的数据库中删除一条记录。

当我在控制台中运行此查询时,我只会得到 ... 作为输出:

db.customers.remove({_id: ObjectId("573318f4336f7de600c419a3"}, true)

当我查询数据库时,我可以看到记录仍然存在:

{
    "_id" : ObjectId("573318f4336f7de600c419a3"),
    "last_name" : "Johnson",
    "gender" : "female",
    "age" : 30,
    "birthdate" : ISODate("1989-09-09T22:00:00Z")
}

我做错了什么?

【问题讨论】:

    标签: mongodb mongodb-query


    【解决方案1】:

    发现问题,没有右括号:

    正确的代码

    db.customers.remove({_id: ObjectId("573318f4336f7de600c419a3")}, true)
    

    【讨论】:

    • 三个点... 曾经表示该语句不完整:)
    猜你喜欢
    • 2011-10-25
    • 1970-01-01
    • 2017-07-22
    • 2015-01-02
    • 2013-02-07
    • 1970-01-01
    • 2021-07-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多