Mongoose UniqueId: A plugin that provides, unique "_id's" accross models

npm install mongoose-uniqueid
14 downloads in the last week
19 downloads in the last month

mongoose-uniqueid Build Status

A mongoose plugin for having a unique ObjectId (the '_id' property) across several collections.

Getting Started

Install the module with: npm install mongoose-uniqueid

var mongoose = require('mongoose'),
    Schema   = mongoose.Schema
    uniqueid = require('mongoose-uniqueid');

var UserSchema = new Schema({}, {_id: false});

UserSchema.plugin(uniqueid, {
  models: ['users', 'organizations']

var OrganizationSchema = new Schema({}, {_id: false});


(Coming soon)


(Coming soon)


In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.


Copyright (c) 2013 Pedro Yamada. Licensed under the MIT license.

npm loves you