Skip to content

Instantly share code, notes, and snippets.

@lukegalea
Created January 30, 2011 01:38
Show Gist options
  • Save lukegalea/802411 to your computer and use it in GitHub Desktop.
Save lukegalea/802411 to your computer and use it in GitHub Desktop.
Mongoose 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,
ObjectId = Schema.ObjectId;
var ObservationSchema = new Schema({
date_time: { type: Date, index: true }, // This works instead: Date
});
mongoose.model('Observation', ObservationSchema);
var Observation = mongoose.model('Observation');
var o = new Observation({ date_time: new Date() });
o.save(global.throwop);
console.dir(o.date_time); // Woah! Why is this {}?
console.dir(o);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment