Skip to content

Instantly share code, notes, and snippets.

@midnightcodr
Created July 2, 2017 05:04
Show Gist options
  • Save midnightcodr/112491378e76a9d52bbee1d032f07093 to your computer and use it in GitHub Desktop.
Save midnightcodr/112491378e76a9d52bbee1d032f07093 to your computer and use it in GitHub Desktop.
using mongoose 4.11.0
const mongoose = require('mongoose')
mongoose.Promise = require('bluebird') // optional, use this to get rid of
// the mpromise DeprecationWarning
const conn = mongoose.createConnection('mongodb://localhost/testDB')
const Schema = mongoose.Schema
const UserSchema = new Schema({
username: String,
email: String
})
const User = conn.model('User', UserSchema)
module.exports = User
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment