不知道在Meteor中将文档插入MongoDB集合时如何使用$currentDate.
这只能用于更新,不能用于插入?这似乎很奇怪,但我看不到其他 Select (除了使用new Date
).
Example
Stuff.insert({
owner: Meteor.userId(),
createdAt: ..., // how to create this field with $currentDate ?
theStuff: "Some of the good stuff"
})
Notes / Thoughts / TL,DR
- 字段不能以$operators开头,据我所知,也不能以大括号
{}
开头. - 如果情况确实如此,那么让一个只处理更新的操作员有什么意义呢?
- 为什么/什么时候
$currentDate
比new Date
好? - 一件很好的事情,如果利用时间的话.js esp是以ISO 8601格式输入$currentDate.
- 答案是从一开始就进行某种升级吗?如果是这样的话,这会产生意想不到的后果吗?