Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ You don't need to define the `id` field in your schema because the plugin automa
UserSchema.plugin(AutoIncrement, {inc_field: 'id'});
```

After requiring the plugin

`var AutoIncrement = require('mongoose-sequence');`

Every time a new user is created, the `id` field will have an incremental number. The operation is atomic and is based on [this](http://docs.mongodb.org/manual/tutorial/create-an-auto-incrementing-field/) specification.
A commodity collection named `counters` is created for you. You can override the name of this collection but we will see this later with the `options`.

Expand Down