Reset Key value store


#1

Hi guys i have a question about the kvs storage. Is it possible to clean the db, delete?

I use the kvs to save some data but i need to reset this data for every conversation an user has with the bot

Thanks in advance


#2

Hi @Soufyanbreda, you can access to kvs table with event.bp.kvs


#3

Hi thanks for your reply in the docs i see the only methods are get en set is it possible to delete?


#4

kvs-records are stored in kvs table which you can manipulate via knex arbitrary.


#5

@Soufyanbreda You can use it like this:

  return event.bp.db.get().then(knex => {
            return knex('kvs').where('key', 'like', "{something}").del().then(function(count) {
                console.log("Deleted " + count + " registers");
                return count;
            });
        });

#6

thanks for the reply this works great