This content has been marked as final. Show 4 replies
Deleting records in a NoSQL store is explained here.
What you want to do is basically a truncate/purge of all data in a store. The multiDelete() method requires a non-null parentKey parameter (the major key path, common to the records that should be deleted). So you cannot use this method without specifying key(s), that is, at least the major key path.
Though, you can get around this and delete all records in the store, by using storeIterator() or storeKeysIterator() to get the keys, and than use them in the delete() or multiDelete() calls.
I actually already tried using storeKeysIterator() with delete() and multiDelete() but I just wanted to know if there was a quicker way of purging the store.
As I understand it, storeKeysIterator() gives me the full key path. That means that using it with multiDelete() is basically the same as using it with delete() (in terms of the time it would take to clear the store). So it would make more sense to use multiDelete() with keys containing only the major key path. Am I right so far?
Is there a quick way for me to get all the major key paths from a store (quick, as in not having to iterate over all of them)?
Your understanding is correct. Also, there is no quicker way of purging the store.
Regarding getting all the major key paths, you would eventually have to use storeKeysIterator() as you do at the moment -- and maybe experiment with various values for batchSize to retrieve more keys per method call.