How to delete data in gun DB? -


i have been developing things , know during prototyping types , tables change quickly... nice cleanup old data , start again in meshes.

for using example http server deleted data.json; forgot localstorage in browser needs cleared.

one might suppose put(null)

i asked on gitter , got

https://github.com/amark/gun/wiki/delete

except deletes , lol, our excuse "it works os, when delete >something gets tossed in trash/recycle bin. that's all." better safe sorry though

if trying "delete" stuff because messed while developing >something, follow 3 step process: 1) localstorage.clear() in every >browser tab have up, 2) crash server , rm data.json, 3) restart >everything. should have clean slate. times while i'm >devleoping put localstorage.clear() @ top of code >have worry clearing server.

welcome gun community! asking questions.

yes, deleting data done gun.put(null). take:

var gun = gun(); var users = gun.get('users'); users.put({alice: {name: 'alice'}, bob: {name: 'bob'}}); // let's delete bob users.path('bob').put(null); 

if (as mentioned in question) however, mean "delete data" in wanting clear out mistakes while developing app. you'll want mentioned: localstorage.clear() in browsers, crash servers , rm data.json.

for other developers, might useful know gun uses type of tombstone method. can't delete nodes themselves, de-referenced, kinda how os moves files trash/recycle-bin. tombstone method important in distributed environment, such "delete" operation replicated every peer.

thanks answering own question though! always, if lost or need hop on https://gitter.im/amark/gun .


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -