訪問MongoDB的一個MongoDB的文檔的關鍵是有沒有辦法刪除文檔的關鍵?即不是僅將該值設置爲空,而是將其刪除?
User.findOne({}, function(err, user){
//correctly sets the key to null... but it's still present in the document
user.key_to_delete = null;
// doesn't seem to have any effect
delete user.key_to_delete;
user.save();
});
我想我已經找到了,但一些測試後:可能不會。儘管如此,這個主題還是有一些很好的討論。 http://groups.google.com/group/mongoose-orm/browse_thread/thread/6053e3b8d4fe9098 – Stephen 2011-08-15 15:28:52
大聲笑沒關係,我想這是你的帖子! – Stephen 2011-08-15 15:31:33
其實它是我的:) – staackuser2 2011-08-22 22:26:03