I am trying to come up with a mongo query which would return me document and only fields (changes in nested document) for particular time range.
This is what I've tried but unfortunately that doesn't work.
Thanks for any help!
Query:
db.keywords.find(
{
$and :[{"_id" : "5374c7a7ac58b0d3b5e970fa"},{"field" : "keywordId"},{"adwordsChanges.timestamp" : {$gte:1400162491325, $lte:23918779329}}]
})
Document:
{
{
"_id": ObjectId("5374c7a7ac58b0d3b5e970fa"),
"documentchanges": [{
"timestamp": NumberLong("1400162491325"),
"field": "syncState",
"old": null,
"new": "OK"
}, {
"timestamp": NumberLong("1400162491325"),
"field": "keywordId",
"old": null,
"new": NumberLong("23918779329")
}, {
"timestamp": NumberLong("1400162491325"),
"field": "adGroupId",
"old": null,
"new": NumberLong("16972286472")
}]
}, {
"_id": ObjectId("5374c7a7ac58b0d3b5e970f9"),
"documentchanges": [{
"timestamp": NumberLong("1400162491325"),
"field": "syncState",
"old": null,
"new": "OK"
}, {
"timestamp": NumberLong("1400162491325"),
"field": "keywordId",
"old": null,
"new": NumberLong("23918779329")
}, {
"timestamp": NumberLong("1400162491325"),
"field": "adGroupId",
"old": null,
"new": NumberLong("16972286472")
}]
}
}