MongoDB Document structure is as follows:
{
"_id" : ObjectId("5755dbcf725c4a1394f5d64f"),
"date_prices" : [
{
"d" : ISODate("2016-06-06T20:23:32.184Z"),
"p" : 895000
},
{
"d" : ISODate("2016-06-10T05:49:25.362Z"),
"p" : 895000
},
{
"d" : ISODate("2016-06-17T22:58:14.002Z"),
"p" : 895000
},
{
"d" : ISODate("2016-06-19T19:46:35.826Z"),
"p" : 895000
}
],
"id" : "6315590",
}
We need to find all documents where the first entry of date_prices
array (index 0 thus) has a date greater than a specific value and where the last array entry (index 3 in the example above) has a date lower than a specific value.
Any hint on how to do this in PHP would be greatly appreciated.
Note: date_prices
array typically contains hundreds of entries.
Many thanks, Tom
UPDATE:
After some further searching I came up with the following request (PHP) but it isn't working - any hint would be appreciated, thx!
array(1) { ["date_prices.0.d"]=> array(1) { ["$gte"]=> string(10) "2011-08-01" } }