我正在使用以下方式将单个单词存储在数据库中:
collection.update({},{$set:{word:newWord}},{upsert:true},function(){
collection.find().nextObject(function(err, results) {
oldWord = results;
console.log("New Word: " + results);
});
});
这是我的数据库示例。
{ "_id" : ObjectId("4ff92def446ce41df5692385"), "word" : "asdf" }
每次到达console.log这一行,它看起来像:
New Word: [object Object]
我正在尝试从上述记录中分离出“asdf”(不带引号)。我已经尝试了toArray、nextObject等所有方法。
我错过了什么?我已经尝试了几个小时了!