Skip to content

Instantly share code, notes, and snippets.

@julianduque

julianduque/db.js

Forked from anonymous/db.js
Last active Dec 21, 2015
Embed
What would you like to do?
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