mongoose-rename-id

1.0.2 • Public • Published

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 });

Package Sidebar

Install

npm i mongoose-rename-id

Weekly Downloads

3

Version

1.0.2

License

ISC

Last publish

Collaborators

  • kozzztya