I am trying to get array count among all documents that array content dates that less and greater than particular input given by me. I edited following query many ways but none of those won't get the result I expected.
db.user_log.aggregate(
{$match: {"user_id" : "2"}},
{$unwind: "$meta_data.access_times"},
{$group: {_id: "$user_id", number: {$sum: 1 }}}
)
above query give me sum of array count given user_id among all the documents. Result as follows.
{
"_id" : "2",
"number" : 26.0
}
How do I use gt and lt in above query?
my array -
"access_times" : [
ISODate("2017-02-25T07:02:31.935Z"),
ISODate("2017-03-25T07:02:39.817Z")
],
I am going to made this array for mongo terminal and java