{ "_id": ObjectId("55d6d1ed54ac98ad306f6a2b"), "position_id": ObjectId("55d6d1ed54ac98ad306f6a2a"), "changes": { "1": { "name": "init" }, "2": { "name": "Test" }, "3": { "total": "100", "realized": "400" }, "4": { "total": "101", "realized": "405" } }}--
You received this message because you are subscribed to the Google Groups "MongoDB по-русски" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user-rus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
{ "_id" : ObjectId("55d6d1ed54ac98ad306f6a2b"), "position_id" : ObjectId("55d6d1ed54ac98ad306f6a2a"), "changes" : [ { "timestamp" : "1", "fields" : [
] }, { "timestamp" : "2", "fields" : [
] }, { "timestamp" : "3", "fields" : [
] }, { "timestamp" : "4", "fields" : [
] } ]}{ "changes": { $elemMatch : { "timestamp" : { $gte : 2 } } }}You received this message because you are subscribed to a topic in the Google Groups "MongoDB по-русски" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user-russian/kEbUydWC0p0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user-rus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
> db.test.find().pretty()
{
"_id" : ObjectId("55d74133823f1a5bc1f02ed1"),
"changes" : [
{
"timestamp" : 1,
"fields" : [ ]
},
{
"timestamp" : 2,
"fields" : [ ]
},
{
"timestamp" : 3,
"fields" : [ ]
}
]
}
{
"_id" : ObjectId("55d74143823f1a5bc1f02ed2"),
"changes" : [
{
"timestamp" : 2,
"fields" : [ ]
},
{
"timestamp" : 3,
"fields" : [ ]
},
{
"timestamp" : 4,
"fields" : [ ]
}
]
}
> db.test.aggregate([
{ $unwind: '$changes' },
{ $match: { 'changes.timestamp': { $gte: 2 } } }
])
{ "_id" : ObjectId("55d74133823f1a5bc1f02ed1"), "changes" : { "timestamp" : 2, "fields" : [ ] } }
{ "_id" : ObjectId("55d74133823f1a5bc1f02ed1"), "changes" : { "timestamp" : 3, "fields" : [ ] } }
{ "_id" : ObjectId("55d74143823f1a5bc1f02ed2"), "changes" : { "timestamp" : 2, "fields" : [ ] } }
{ "_id" : ObjectId("55d74143823f1a5bc1f02ed2"), "changes" : { "timestamp" : 3, "fields" : [ ] } }
{ "_id" : ObjectId("55d74143823f1a5bc1f02ed2"), "changes" : { "timestamp" : 4, "fields" : [ ] } }