例如我的数据是{'abc':'def'},它有一个键值;
我想要这个:
do something...//data has been changed to {'abc':'defghi'} or {'abc':'['def','ghi']'}
我在nodejs中使用了这段代码:
var tmp2 = {'userid:location:2013-01-02 15':['092030', '12122.11260E']};
collection.insert(tmp2, {safe:true}, function (err, result) {
var i = 0;
var a = +new Date();
while(i<300000){
tmp2['userid:location:2013-01-02 15'].push(i);
collection.save(tmp2, function () { })
i+=1;
}
var b = +new Date();
console.log(b-a)
});
save api可以替换相同的密钥值,因此使用push,我可以追加数据到exising密钥的值;
但是有一些问题: