Skip to content

Instantly share code, notes, and snippets.

@lukegalea
Created January 31, 2011 00:55
Show Gist options
  • Save lukegalea/803495 to your computer and use it in GitHub Desktop.
Save lukegalea/803495 to your computer and use it in GitHub Desktop.
Mongoose Find Issue
var path = path = require('path');
require.paths.unshift(path.join(__dirname, "../node_modules"));
require.paths.unshift(path.join(__dirname, "../vendor"));
require('noop');
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
mongoose.connect('mongodb://localhost/pumper');
var ObservationSchema = new Schema({
date_time: Date//{ type: Date, index: true },
});
var UserSchema = new Schema({
date_time: Date//{ type: Date, index: true },
});
mongoose.model('Observation', ObservationSchema);
mongoose.model('User', UserSchema);
var Observation = mongoose.model('Observation'),
User = mongoose.model('User');
var o = new Observation({ date_time: new Date() });
o.save(global.throwop);
mongoose.model('Observation').find({}, null, {}, function(err, observations) {
console.dir(observations);
});
@lukegalea
Copy link
Author

Yep. Same deal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment