Created
January 30, 2011 01:38
-
-
Save lukegalea/802411 to your computer and use it in GitHub Desktop.
Mongoose Issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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