[英]Meteor - move data from one collection to another
我正在嘗試將Mongo文檔從一個集合移動到另一個集合,但無法使其正常工作(在服務器方法中):
var oldData = newCollection.findOne({name: name});
if(oldData){
console.log(oldData); // this works
oldCollection.insert({oldData}); // this doesn't
}
其他方式:
var oldData = newCollection.findOne({name: name});
if(oldData){
console.log(oldData.score); // this works
oldCollection.insert({
score: oldData.score
}); // this doesn't
怎么了
您不需要在選項1中使用大括號oldCollection.insert(oldData)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.