I have just installed MongoDB in my machine (Windows 7) and installed node-mongodb-native using npm on cygwin. It appears to work fine and I am going through running all the examples.
In the simple.js example, it connects to the database and inserts 3 entries and then fetches them from the database. the only glitch is that the _id.generationTime attribute is always "Invalid Date". I think this should have been automatically set to the time when the objects开发者_运维问答 were created.
I am planning on using mongodb and node.js on a project and that will require having the time at which entries were created in the database. Is there a way I could get it to work? Or do I have to store the time as a separate attribute of the object?
Might be a bug. In the meantime, use a Date field:
var myModel = new Schema({
...
created_at: { type: Date, default: Date.now }
})
精彩评论