我正在寻找Lawnchair website的文档,我正在试图弄清楚如何为现有数据插入新值对。
在Lawnchair网站上的示例。
var people = new Lawnchair('people');
var me = {name:'brian'};
people.save(me);
现在,如果我想添加“brian”年龄。
我有点像people.append("{key:mykey, age:30}")
这样的东西,但看起来没有这样的方法?
有没有其他方法可以做到这一点?
答案 0 :(得分:0)
我对LawnChair不太熟悉,但在我能理解的范围内,我会建议如下:
people.find('r.name == "brian"', function(r){
//remove 'r' (from the main storehouse) here somehow, I dont know how.
r.key = yourkey
r.age=30
people.save(r)
});
age
字段添加到已保存的对象请告诉我这是否有帮助。 : - )