Update README.md

pull/2/head
Louis Chatriot 12 years ago
parent 2872a32cca
commit 30123eb018
  1. 7
      README.md

@ -285,9 +285,10 @@ db.remove({ system: 'solar' }, { multi: true }, function (err, numRemoved) {
### Indexing ### 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 for value equality, but I am planning on adding value comparison soon. 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 for value equality, but I am planning on adding value comparison soon.
Also note that if you use a unique constraint on a field, you will only be able to save one document in which is `undefined`. The second time you do that, the index will reject the document since there is already one with the `undefined` value. I am working on a "sparse" option just like the MongoDB one, enabling indexes to check uniqueness only when the field is defined. Notes:
* If you use a unique constraint on a field, you will only be able to save one document in which is `undefined`. The second time you do that, the index will reject the document since there is already one with the `undefined` value. I am working on a "sparse" option just like the MongoDB one, enabling indexes to check uniqueness only when the field is defined.
Finally, the `_id` is always indexed with a unique constraint, so queries specifying a value for it are very fast. * The `_id` is always indexed with a unique constraint, so queries specifying a value for it are very fast.
* Currently, indexes are implemented as binary search trees. I will use self-balancing binary search trees in the future to guarantee a consistent performance.
```javascript ```javascript

Loading…
Cancel
Save