0

如何从集合中删除节点?

例如,我想velociraptordinos集合中删除。但是当我运行脚本时,我仍然看到执行dinos后有两个节点dinos.map().val(cb)

const Gun = require('gun');    
const gun = new Gun({ peers: [ 'https://localhost:8888/gun' ] });

const app = gun.get('park');
const dinos = app.get('dinos');

const velociraptor = app.get('velociraptor').put({
  statistics: {
    force: 9,
    speed: 15
  }
});

const trex = app.get('trex').put({
  statistics: {
    force: 25,
    speed: 5
  }
});

dinos.set(velociraptor);
dinos.set(trex);

//velociraptor.put(null);
app.get('velociraptor').put(null);

dinos.map().val((v, k) => {
  console.log(k);
  console.log(v);
});
4

1 回答 1

1

可以试试这个为枪提供“unset()”方法的 npm 包。

http://npmjs.com/package/gun-unset
于 2017-11-02T19:31:25.917 回答