MongoDB + Node.js: unable to insert date properly

后端 未结 3 539
清歌不尽
清歌不尽 2021-01-12 03:25

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

3条回答
  •  花落未央
    2021-01-12 03:58

    ISODate is the native way for mongo to store date. I use node-mongodb-native npm module and I store/retrieve javascript Date using new Date() idiom like in your examples. I don't know if it's a recent correction because I started node and Mongo in 2012, but using date was pretty straightforward for me.

提交回复
热议问题