Skip to content

Instantly share code, notes, and snippets.

@onel0p3z
Forked from julianduque/db.js
Created August 21, 2013 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onel0p3z/6299364 to your computer and use it in GitHub Desktop.
Save onel0p3z/6299364 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