mongoose-rename-id
v1.0.2
Published
Plugin to use id instead of _id
Downloads
20
Maintainers
Readme
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 });