Update README.md

pull/2/head
Louis Chatriot 12 years ago
parent ba260ed476
commit 9f636f8ca2
  1. 10
      README.md

@ -294,6 +294,16 @@ d.ensureIndex({ fieldName: 'somefield', unique: true }, function (err) {
// The ensureIndex method can be called whenever you want: before or after a loadDatabase(),
// after some data was inserted/modified/removed. It will fail to create the index if the
// unique constraint is not satisfied
// Format of the error message when the unique constraint is not met
d.insert({ name: 'nedb' }, function (err) {
// err is null
d.insert({ name: 'nedb' }, function (err) {
// err is { errorType: 'uniqueViolated'
// , key: 'name'
// , message: 'Unique constraint violated for key nedb' }
});
});
```

Loading…
Cancel
Save