考虑一个在MongooseJS上运行的MongoDB集合。
示例代码:
Person.where('uid').equals(19524121).select('name').exec(function(err, data){
// Here I can get the data correctly in an array.
console.log(JSON.stringify(data));
data[0].name = "try to save me now"; // Select the first item in the array
data[0].save(); // Object #<Promise> has no method 'save'.
}
错误 - 似乎找不到解决方法。
对象 #<Promise> 没有方法 'save';
我有点困惑为什么会出现这种情况,已经进行了相当多的研究,但好像找不到直接的答案。