gun 0.8.9, Node.js
In the API reference written
users.map().val(cb) gets each user once, including ones that are added over time.
But for me, it returns duplicates starting from the second run. The more I run the script, the more duplicates I receive.
Why? How can I list all dinosaurs from the dinos
set without duplicates?
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);
dinos.map().val((v, k) => {
console.log(k);
console.log(v);
});
My local data.json file content https://gist.github.com/sergibondarenko/8e56ca1cde4ef9875c2238a8b4c9808d