I used node-mongoskin to connect these two. Everything was fine until I requested some kind of "date" field, which, I think, should be returned as a Date javascript object. But the result type was a string that is odd (for me) and uncomfortable.
The insert looks something like this:
var doc = { date: new Date(), info: 'Some info' } db.users.insert( doc, {safe: true}, function(err, res) { ... });
And the result above (without _id field):
{ "date" : "Mon Oct 24 2011 18:00:57 GMT+0400 (MSK)", "info": "Some info" }
However, pasting with MongoDB Shell works just fine, except for the ISODate field ISODate
> db.things.insert({ date: new Date() }); db.things.find(); { "_id" : ObjectId("4eae9f2a34067b92db8deb40"), "date" : ISODate("2011-10-31T13:14:18.947Z") }
So, the question arises: how should documents be inserted into request date fields as a Date object? I want to set fields on the server side of the database. I just send something like null fields, and db-server sets for me those that use mongo mechanisms by default.
Inserting timestamps (like MongoDB's native mark ) is also a problem, but it is not so important.
PS: No luck going through mongoskin and mongodb-native docs.
elmigranto
source share