我被要求在MongoDB中执行一个非常基本的查询任务但是我无法理解如何正确查询具有正确语法的聚合函数的集合。
我需要查询电子邮件集合中的所有电子邮件附件大小&今天总结一下。客户要求我将所有电子邮件附件分组为一天(今天)的帐户。我怎么能找到这个?
以下是db.email.findOne()的输出:
{
"_id" : ObjectId("55893983e4b0ea8af5a61550"),
"customer_id" : "12345",
"Subject" : "test message",
"Date" : ISODate("2016-08-04T10:48:13Z"),
"headers" : [
"Date: Tue, 23 Jun 2015 12:48:13 +0200 (CEST)",
"From: user@domain.tld",
"Message-ID: <240354118.javamail.email.server.tld>",
"Subject: Cats",
"Content-Type: text/plain; charset=us-ascii",
"Content-Transfer-Encoding: 7bit",
"To: undisclosed-recipients:;",
"X-ClamAV: clean"
],
"text" : "feed the cats please",
"attachments" : [ ],
"langprob" : 0.8301894511454121,
"original_message_file_id" : "239863489r7637208",
"account_id" : "xxx",
"received_time" : ISODate("2015-06-23T10:48:35.097Z"),
"direction" : "inbound",
"state" : "CLOSED",
"encryption_key_id" : null,
"size" : 1651,
"routing_type" : "PUSH",
"priority" : 1,
"closed_time" : ISODate("2015-07-10T21:02:53.409Z")
}
任何人都可以帮我正确创建JSON语法查询,根据我的谓词从MongoDB中提取我需要的数据吗?
感谢您的帮助!