1.0.2 • Published 8 years ago

mongoose-rename-id v1.0.2

Weekly downloads
159
License
ISC
Repository
github
Last release
8 years ago

Mongoose rename _id plugin

Can change "_id" to "id" for all queries besides Model.create().

var renameIdPlugin = require('mongoose-rename-id');

schema.plugin(renameIdPlugin({newIdName: 'id'}));

Post.create({ _id: id });

Post.find({ id });
Post.update({ id }, {some: true});
Post.findOneAndUpdate({ id }, {some: true});
Post.remove({ id });