Hi,
I am trying to reproduce the following working query - from mongo console
- using mongo-odm.
db.Record.aggregate([ {$match: {member: DBRef("Member",
ObjectId("556e5dbfa10fdb0ddc0041c5"), "doctrine_odm")}}, {$sort:
{timestamp: -1}}, {$group : {_id : "$details.type", firstRecord: {$first:
"$_id"}}} ])
A sample Record is
{
"_id" : ObjectId("556e5dbfa10fdb0ddc0041c8"),
"member" : DBRef("Member", ObjectId("556e5dbfa10fdb0ddc0041c5"),
"doctrine_odm"),
"timestamp" : ISODate("2015-06-03T01:51:59Z"),
"details" : [
{
"accountNumber" : "101",
"type" : "premium"
}
]
}
I've tried several formats and the latest - still not working - is like this
$collection = $dm->getDocumentCollection('Record');
$pipeline = array(
array(
'$match' => array(
"member" => \MongoDBRef::create("Member", "556e5dbfa10fdb0ddc0041c5",
"doctrine_odm")
)
),
);
$results = $collection->aggregate($pipeline);
Thanks.
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.