0

我想从我的数据库中删除一个特定点

// DB layout

{
    id: 9243
    email: asd@asd.asd
    //stuff
    point0:{
        //stuff
        point1:{
            //stuff
            point2:{
                //stuff (dynamic)
            }
        }
    }
}

现在我想从我的数据库中删除 point2 - 没有!知道里面有什么

//actual state of dev:

collection.update({'email': mail}, { $pull: elem }, function(err){

//tested:
elem = { "point0.point1" : "point2" }
elem = "point0.point1.point2"
elem = { "point0.point1.point2" : "" }
pullAll
... etc
4

1 回答 1

2

您是否尝试过使用$unset来删除该值point2

collection.update({'email' : mail}, {$unset : {'point0.point1.point2' : 0}}, function (err) {})
于 2013-08-08T02:47:30.210 回答