Merge branch 'master' of github.com:louischatriot/nedb

pull/2/head
Louis Chatriot 12 years ago
commit 7254e17e6f
  1. 7
      README.md

@ -64,7 +64,7 @@ You can use `find` to look for multiple documents matching you query, or `findOn
```javascript ```javascript
// Let's say our datastore contains the following collection // Let's say our datastore contains the following collection
// { _id: 'id1', planet: 'Mars', system: 'solar', inhabited: false } // { _id: 'id1', planet: 'Mars', system: 'solar', inhabited: false }
// { _id: 'id2', planet: 'Earth', system: 'solar', inhabited: true, humans: { genders: 2 } } // { _id: 'id2', planet: 'Earth', system: 'solar', inhabited: true, humans: { genders: 2, eyes: true } }
// { _id: 'id3', planet: 'Jupiter', system: 'solar', inhabited: false } // { _id: 'id3', planet: 'Jupiter', system: 'solar', inhabited: false }
// { _id: 'id4', planet: 'Omicron Persia 8', system: 'futurama', inhabited: true } // { _id: 'id4', planet: 'Omicron Persia 8', system: 'futurama', inhabited: true }
@ -84,6 +84,11 @@ db.find({ "humans.genders": 2 }, function (err, docs) {
// docs contains Earth // docs contains Earth
}); });
// You can also deep-compare objects. Don't confuse this with dot-notation!
db.find({ humans: { genders: 2 } }, function (err, docs) {
// docs is empty, because { genders: 2 } is not equal to { genders: 2, eyes: true }
});
db.find({}, function (err, docs) { db.find({}, function (err, docs) {
// docs contains all documents in the collection // docs contains all documents in the collection
}); });

Loading…
Cancel
Save