How to insert a document with date in mongo?

前端 未结 3 1923
逝去的感伤
逝去的感伤 2020-12-02 01:47

We are trying to insert a document with the current date as it\'s field. We are writing in java using eclipse plugin for mongodb. We want to execute the Date()

3条回答
  •  既然无缘
    2020-12-02 02:05

    You can do it trying something like this:

    db.example.insert({"date":ISODate("2016-03-03T08:00:00.000")});
    

提交回复
热议问题