Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8415367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:25:36+00:00 2026-06-10T01:25:36+00:00

I′ve been using node-mongoskin to connect this two. Everything was ok until I queried

  • 0

I′ve been using node-mongoskin to connect this two. Everything was ok until I queried some “date” field which I think should be returned as javascript′s Date object. But result′s type was string, which is odd (for me) and inconvenient.

Inserting looks something like this:

var doc = {
  date: new Date(),
  info: 'Some info'
}
db.users.insert( doc, {safe: true}, function(err, res) {
  ...
});

And result of above is (without _id field):

{ "date" : "Mon Oct 24 2011 18:00:57 GMT+0400 (MSK)", "info": "Some info" }

However, inserting with MongoDB Shell works just fine, except type of field is ISODate

> db.things.insert({ date: new Date() }); db.things.find();
{ "_id" : ObjectId("4eae9f2a34067b92db8deb40"), "date" : ISODate("2011-10-31T13:14:18.947Z") }

So, the question is: how should I insert documents to query date fields as Date object? What I want is setting fields on database-server-side. I just send something like null-fields, and db-server setting those for me using default mongo′s mechanisms.

Inserting timestamps (as native MongoDB timestamp) is also a problem, but it′s not such a big deal.

PS: No luck going through mongoskin and mongodb-native docs.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T01:25:37+00:00Added an answer on June 10, 2026 at 1:25 am

    It was probably some bug in my code or the mongo driver. Now, the following works just fine:

    db.collection.insert({d: new Date()});
    

    Timestamps support described here: https://mongodb.github.io/node-mongodb-native/api-bson-generated/timestamp.html.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been using socket.io with node.js and came across Nowjs , it seems this
I am experiencing this problem with Node.js express framework 3.0: https://github.com/visionmedia/express/issues/1187 I've been using
I have been using node and redis for some time. The problem I am
Sorry if this question is simple but I have been using node.js for only
I've been using FB Connect for some time now. The code below has worked
I have been using TortoiseSVN for some time and I really like it. I
I've been using this script for a long time and it works perfectly in
I've been using node .4x and npm, and decided to upgrade to .67. Oh
I've been using the Enyim Memcached Client for .Net , trying to connect to
I'm trying to a create a fully functional web proxy using node.js which essentially

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.