mongoose-id-token
Creating automatically an uniq token field
Installation
npm install mongoose-id-token
Or add it to your package.json
Usage
For starting, you need to simply add the mongoose-id-token plugin:
var mongoose = mongooseIdToken = Schema = mongooseSchema var Model = title: String message: String Model
The plugin will create a new field and will create a uniq token on the first saving of the document. You can also change the name of the field by setting the configuration customCollectionName:
var options = fieldName: "token" createIndex: true tokenLength: 16Model
License
MIT License