electron Search in nedb


Example

In order to search for records in nedb, again we need to just pass the json containing the search criteria as a parameter to the find function of db object.

db.find({ name: 'bigbounty' }, function (err, docs) {
  // docs is an array containing documents that have name as bigbounty
  // If no document is found, docs is equal to []
});

In order to find only one document, as in we use limit in mysql, it's easy in nedb.

db.findOne({ name: 'bigbounty' }, function (err, doc) {
  // doc is only one document that has name as bigbounty
  // If no document is found, docs is equal to []
});