Created
July 2, 2020 14:47
-
-
Save simon-tiger/775237bbede08763ee884206790ee4f0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// First you have to install NeDB. For this, you can just use `npm install nedb`. | |
// To create a database, do this: | |
const Datastore = require("nedb"); | |
const db = new Datastore("database.db"); | |
// Then, to query it, do this: | |
db.find({ property: requiredValue }, (err, results) => { | |
// results will hold the result | |
}); | |
// To insert an entry, do this: | |
db.insert(whateverObjectYouWant); | |
// Finally, to update it, do this: | |
db.find({ property: requiredValue }, { $set: { property: newValue } }, (err, results) => { | |
// this code will happen when it's done updating | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment