electron Insert Data in nedb


Basically, in order to insert records to nedb, the data is stored in the form of json with the key being the column names and the value for those names will be the values for that record.

var rec = { name: 'bigbounty',age:16};

db.insert(rec, function (err, newrec) {   // Callback is optional
  // newrec is the newly inserted document, including its _id
  // newrec has no key called notToBeSaved since its value was undefined

Be careful with all the operations of database, as they are asynchronous.

Note ** : If _id is not there in the json data that you are inserting then automatically ,it will be created for you by nedb.