To use NeDB in a web browser, include the nedb.js or nedb.min.js bundle in your HTML file. Once loaded, the global Nedb object is available and provides the same API as the Node.js version.
If you instantiate new Nedb() without a filename, the database operates entirely in-memory. If you provide a filename, NeDB becomes persistent by automatically selecting the best available storage method via localforage (IndexedDB, WebSQL, or localStorage).
WARNING: The storage system changed between v1.3 and v1.4 and is not back-compatible. Applications must resync client-side when upgrading NeDB versions.
<script src="nedb.min.js"></script>
<script>
var db = new Nedb(); // Create an in-memory only datastore
db.insert({ planet: 'Earth' }, function (err) {
db.find({}, function (err, docs) {
// docs contains the two planets Earth and Mars
});
});
</script>