Ionic 2 Storage - CRUD Functionality


#1

I am new to the NoSQL world and since Ionic 2 by default supports simple key-value DB, I was to some help here.

My app has a very large form. How do I go about saving new records? How do I retrieve those particular records?

Currently, to save a new record, I am doing something like this:

save(data){
    let newData = JSON.stringify(data);
    this.storage.set('reports', newData);
}

The problem with this is it overwrites the record instead of inserting a new record.

I am retrieving records like this:

getData() {
    return this.storage.get('reports');  
}

How do I go about fetching a particular record using certain values in the stored JSON?

Thanks.