File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,11 +19,22 @@ npm install feathers-nedb --save
1919Creating an NeDB service is this simple:
2020
2121``` js
22+ var NeDB = require (' nedb' );
2223var service = require (' feathers-nedb' );
23- var nedb = require (' nedb' );
24+ var service = require (' nedb' );
2425
26+ var db = new NeDB ({
27+ filename: ' ./data/todos.db' ,
28+ autoload: true
29+ });
2530
26- app .use (' todos' , nedb (' todos' , options));
31+ app .use (' todos' , service ({
32+ Model: db,
33+ paginate: {
34+ default: 2 ,
35+ max: 4
36+ }
37+ }));
2738```
2839
2940This will create a ` todos ` datastore file in the ` db-data ` directory and automatically load it. If you delete that file, the data will be deleted.
@@ -181,7 +192,6 @@ app.use('/todos', myService);
181192The following options can be passed when creating a new NeDB service:
182193
183194- ` db ` - The NeDB database instance
184- - ` id ` (default: ` _id ` ) [ optional] - The name of the id property
185195- ` paginate ` [ optional] - A pagination object containing a ` default ` and ` max ` page size (see below)
186196
187197
You can’t perform that action at this time.
0 commit comments