Intergrating with pouchDb some error

import PouchDB from 'pouchdb';
export class HomePage {
   public temp=[];
  this.db = new PouchDB('cloudo');
  saveData(data) {

above in saveData function I am getting below error

Runtime Error
Uncaught (in promise): {"status":400,"name":"bad_request","message":"Document must be a JSON object"}


temp is an array right now, not an object.
What does the console.log(data) output?


when I console like above console.log(data) its showing like below



Just to show what I mean, please duplicate the push line and show the log output again.


kept like this


got this

 [Object, Object]


hey I gave like this

 public temp:Object;

now its showing

 {status: 412, name: "missing_id", message: "_id is required for puts", error: true, __zone_symbol__currentTask: t}

but in above multiple times if I want to push then will be prob… for me


Which means you have 2 objects in an array. Error message tells you, that you need one object. So your code is wrong and won’T work.


See, now you have the correct data type and get a new error. What does console.log output now before you do the pouchdb stuff?

Object {nikhil: "nikhil"}


Now connect that with the error message, that tells you that you need _id in there for what you want to do…


gave like this

    "_id " :1,

but still same error


I have no idea about PouchDB, but googling for “pouchdb getting started” gave me this on #1:


hmm ok thanks will see