From 2872a32ccac34db17f328e56c0e4bd16da2574ce Mon Sep 17 00:00:00 2001 From: Louis Chatriot Date: Sun, 2 Jun 2013 01:16:34 +0300 Subject: [PATCH] Update README.md --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 9177a86..b33f04c 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,16 @@ It's a subset of MongoDB's API (the most used operations). The current API will * Indexing ### Creating/loading a database +You can use NeDB as an in-memory only datastore or as a persistent datastore. + ```javascript +// In-memory only datastore +var Datastore = require('nedb') + , db = new Datastore(); // Call the constructor without any argument +// No need to call loadDatabase(), you can begin inserting data and query it right away + + +// Persistent datastore var Datastore = require('nedb') , db = new Datastore('path/to/datafile'); @@ -34,6 +43,7 @@ db.loadDatabase(function (err) { // Callback is optional // err is the error, if any }); + // Of course you can create multiple datastores if you need several // collections. For example: db = {};