Skip to content

Instantly share code, notes, and snippets.

@julianduque
Forked from anonymous/db.js
Last active December 21, 2015 11:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save julianduque/6299206 to your computer and use it in GitHub Desktop.
Save julianduque/6299206 to your computer and use it in GitHub Desktop.
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/app');
var usrSchema = new mongoose.Schema({
user: { type: String, required: true },
password: { type: String, required: true },
DLU: { type: Date }
});
exports.db = mongoose.connection;
exports.User = mongoose.model('user', userSchema);
var db = require('./db').db;
var User = require('./db').User;
User.find(function(err,docs){
console.log(docs);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment