i'm new in Nosql. i'm using Mongodb shell for the first time. i've seen other related solutions but non of them is working for me. i have an object that contains several nested arrays i want to remove the data that are not in 2016. the collection looks like this.
"_id" : ObjectId("58754aa6b10700f77b90c018"),
"results" : [
{
"series" : [
{
"name" : "light",
"columns" : [
"time",
"agent_id",
"device_id",
"rpi_id",
"type",
"value"
],
"values" : [
[
"1970-01-01T00:00:01.474264311Z",
null,
"2:1",
"b07882d6-5c28-597b-89f9-d250f74b0bad",
"light",
"231"
],
[
"1970-01-01T00:00:01.474280348Z",
null,
"1:1",
"b07882d6-5c28-597b-89f9-d250f74b0bad",
"light",
"404"
],
[
"1970-01-01T00:00:01.474280526Z",
null,
"2:1",
"b07882d6-5c28-597b-89f9-d250f74b0bad",
"light",
"239"
],
[
"2016-12-21T23:36:32Z",
"fce19d9c-3bba-5b18-9854-f86776b47a9c",
"4",
null,
null,
"1019"
],
[
"2016-12-21T23:36:56Z",
"fce19d9c-3bba-5b18-9854-f86776b47a9c",
"1",
null,
null,
"1023"
],
[
"2016-12-21T23:37:00Z",
"fce19d9c-3bba-5b18-9854-f86776b47a9c",
"5",
null,
null,
"1022"
]
]
}
]
}
]
for example i tried this query to find them but the result is the whole collection:
db.lights.find({"results.series.values": {$elemMatch : {$elemMatch: {$not : /^2016/} } } })
i'll be so grateful if anyone could answer it.