3

The documentation says

If you specify a filename, the database will be persistent, and automatically select the best storage method available (IndexedDB, WebSQL or localStorage) depending on the browser.

The very short example shows only in-memory usage. I am not sure what kind of a filename I can specify so that it makes sense to the client browser.

Suggestions?

Update: A little more context. I want to do offline storage in the client's browser and then sync to the server periodically (when connection is available). I am not sure if NeDB is the correct way to achieve this, so suggestion on this also welcome.

punkish
  • 13,598
  • 26
  • 66
  • 101

1 Answers1

2

You need to specify a filename and autoload... It works for me:

var db = new Nedb({
    filename: 'library.db',
    autoload: true
  });
Drew
  • 24,851
  • 10
  • 43
  • 78
Emilio GC
  • 21
  • 2