Open vedtam opened 7 years ago
After some testing around I came to the conclusion that this works but is somewhat undocumented.
Just set an id to the document.
<app-pouchdb-document
id = "timeDoc"
db-name="ezq"
data="{{time}}">
</app-pouchdb-document>
Remember to omit the doc-id since we want a new one made.
Then in a button event just call save on the document like this.
_addTime: function(){
this.$.timeDoc.save();
}
That's all there is to it.
I am trying to save a list of products to the local database, coming from my server in the form of a json array using the app-pouchdb element.
What I need is to create a document for each product so I can query the local database later, using the document _id, but as I see the element asks for a doc-id (ie.: parsip) right at the start:
Using the same _id, rows are overwritten and I end up with only one document in the end. I have read the docs a few times, but I can't find any hint on achieving separate document for each product from my array.