function update(name,age){
db.collection('birds').where({}).update({data:{name:name,age:age}}).then(console.log)
}
function remove(){
db.collection('birds').where({age:12}).remove().then(console.log)
}
function add(){
db.collection('birds').add({data:{age:12,env:'dongtai',hobbies:['sing','fly'],name:'blackbird'}}).then(console.log)
}
setTimeout(update,2000,'grey8Bird',12)
setTimeout(add,0)
这段代码中,倒数第二句: setTimeout(update,2000,'grey8Bird',12),若间隔delay time为1秒,就出初始化那次外,watch不会再触发其他onChange事件,为2秒时,就是没update一条doc就onChange触发一次。好奇怪啊?
sorry,代码背景失误
瞎了