MongoDB上运行MongoDB的日期语法是什么? [英] What is the syntax for Dates in MongoDB running on MongoLab?

查看:249
本文介绍了MongoDB上运行MongoDB的日期语法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

而不是ObjectId('82he921he982he82')其对象Id的_id:{$ oid:82he921he982he82},但我不知道如何在MongoLab中的文档中创建日期值: p>

Instead of ObjectId('82he921he982he82') its "_id":{"$oid":"82he921he982he82"} for object Ids, but I have no idea how to create a date value in a document on MongoLab :s

推荐答案

如果您正在使用其中一个驱动程序,则可以通过该语言的Date类创建一个日期。例如,在Javascript(如Node.js)中,它将是新日期(11,11,11)。如果使用MongoLab REST API或管理界面,您可以使用以下语法代表日期:

If you are using one of the drivers, you create a date via that language's Date class. For instance, in Javascript (like Node.js) it would be 'new Date(11,11,11)'. If using the MongoLab REST API or admin UI you represent dates with this syntax:

  { "$date": "2010-10-28T23:07:11Z" }

这篇关于MongoDB上运行MongoDB的日期语法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆