【发布时间】:2015-11-17 15:53:21
【问题描述】:
如何从一个月前使用 moment.js 创建的集合中获取记录,返回所有记录的计数。
我的收藏代码是:
Products.find() // where start and end date is one month ago and products is the collection
这可能是一个愚蠢的问题,但是,由于我是从 rails 到 javascript/meteor,所以有一点帮助就可以了。
示例文档
{
"_id": "xxx",
"name": "xxx",
"description": "xxx",
"createdAt": "2015-04-18T04:40:00Z",
"productType": "Flavoured Milk",
"opt1": "Packaging",
"opt2": "Weight",
"supplier": "xxx",
"brand": "xxx"
"status": "active",
"tags": ["xxx","xxx"],
"updatedAt": "2015-04-18T04:40:00Z"
}
【问题讨论】:
-
Uchenna,你试过什么?你也是从它们创建的那一天开始测量的吗?还是
start和end date?你能写出你的documents的一个样本吗? -
这个问题至少需要一个文档示例才能回答。
-
@inspired 我更新了我的问题
-
我从一个月前开始测量
-
我在发布此问题之前尝试了所有答案,但没有成功。再次查看我的文件,发现一个月前我没有创建任何文件。感谢您的帮助
标签: javascript mongodb meteor momentjs