Reputation: 3331
I'm trying to find documents by only the document name in NeDB. I have read through the documentation, but all examples also search on a value. I am only inserting one document, and need to query by its name only.
const Datastore = require('nedb')
, db = new Datastore({ filename: './data/database.json', autoload: true })
db.find("myDocName", (err, docs)=>{ // this returns no results even though the document exists
if(docs[0]){
console.log(docs[0])
} else {
database.db.insert({myDocName: {some: "data"})
}
})
I have also tried matching any value with regular expressions, to no avail:
let regEx = /.*/
database.db.find({"myDocName":regEx}, (err, docs)=>{
....
Upvotes: 0
Views: 691