Skip to content

Instantly share code, notes, and snippets.

@thoughtspeed7
Created April 23, 2018 11:21
Show Gist options
  • Save thoughtspeed7/68f187042fee49aad1742d0a0b3e73bb to your computer and use it in GitHub Desktop.
Save thoughtspeed7/68f187042fee49aad1742d0a0b3e73bb to your computer and use it in GitHub Desktop.
Reusing Mongoose Schema
// om namah shivay
const mongoose = require('mongoose');
const common = require('./common');
const user_schema = new mongoose.Schema({
_id: mongoose.Schema.ObjectId,
first_name: String,
last_name: String,
mobile: common.mobile,
roaming_mobile: common.mobile
}, {
collection: 'User'
});
const user_model = mongoose.model('User', user_schema);
module.exports = {
user_model
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment