diff --git a/README.md b/README.md index 35389b0..87c61c8 100644 --- a/README.md +++ b/README.md @@ -288,7 +288,7 @@ db.remove({ system: 'solar' }, { multi: true }, function (err, numRemoved) { ### Indexing NeDB supports indexing. It gives a very nice speed boost and can be used to enforce a unique constraint on a field. You can index any field, including fields in nested documents using the dot notation. For now, indexes are only used to speed up basic queries and queries using `$in`, `$lt`, `$lte`, `$gt` and `$gte`. -To create an index, use `datastore.ensureIndex(options, cb)`, where callback is optional and get passed an error if any. The options are: +To create an index, use `datastore.ensureIndex(options, cb)`, where callback is optional and get passed an error if any (usually a unique constraint that was violated). `ensureIndex` can be called when you want, even after some data was inserted, though it's best to call it at application startup. The options are: * **fieldName** (required): name of the field to index. Use the dot notation to index a field in a nested document. * **unique** (optional, defaults to `false`): enforce field uniqueness. Note that a unique index will raise an error if you try to index two documents for which the field is not defined.