I have documents that look like this (for example purposes).
{
"_id" : ObjectId("591675e89a89201e4d520c89"),
"raw_data_history" : {
"APR-2017" : [
{
"count" : "540421",
"reason" : "blah blah",
},
{
"count" : "111111",
"reason" : "blah blah 2",
}
],
"MAY-2017" : [
{
"count" : "13",
"reason" : "blah blah",
},
{
"count" : "100",
"reason" : "blah blah 2",
}
],
},
"review" : false,
"active" : true,
}
I want to get all the documents in the collection where APR-2017 has more than 1 array element contents. I have tried the following:
db.getCollection('collections').find( {raw_data_history.APR-2017 : {$exists:true}, $where:'this.raw_data_history.APR-2017.length>1'} )
but I get
Error: Line 1: Unexpected token .
How can I do that?