Hello

I have tried, un successfully of course, to build a doctrine query using 
the aggregate builder with a $or inside a $match. Below is a working query 
and its data.

Any help would be greatly appreciated.

Mongod ver 3.2.   
php 5.6 / mongodb 1.2.2
doctrine/mongodb-odm: ^1.1
   Using a zend wrapper around doctrine 
mongo: https://packagist.org/packages/doctrine/doctrine-mongo-odm-module

db.getCollection('tickets').aggregate({
   $match:{
      $or:[
         {
            "ticket.ticketId":RegExp('200')
         },
         {
            "ticket.tName":RegExp('Nambey')
         }
      ]
   }
})

Here is the data. Not very representative but I am able to show what 
pipeline I would like to build.

{
    "_id" : ObjectId("58052e0215b15da22f8b4567"),
    "sellerId" : "1234",
    "transactionId" : "1234",
    "sellerGroup" : "FooBar",
    "ticket" : [ 
        {
            "ticketId" : "2008",
            "tUnitsSold" : 2,
            "tNetAmount" : 20,
            "tName" : "Cool Name",
            "tType" : "General",
            "expirationDate" : "20160829",
            "_id" : ObjectId("58052e0215b15da22f8b4568")
        }, 
        {
            "ticketId" : "2009",
            "tUnitsSold" : 2,
            "tNetAmount" : 30,
            "tName" : "Nambey Bambey",
            "tType" : "Special",
            "expirationDate" : "20161030",
            "_id" : ObjectId("58052e0215b15da22f8b4569")
        }
    ]
}
{
    "_id" : ObjectId("58052e0215b15da22f8b4570"),
    "sellerId" : "34",
    "transactionId" : "1235",
    "sellerGroup" : "FooBar2",
    "ticket" : [ 
        {
            "ticketId" : "2010",
            "tUnitsSold" : 2,
            "tNetAmount" : 40,
            "tName" : "Cool Name",
            "tType" : "General",
            "expirationDate" : "20160829",
            "_id" : ObjectId("58052e0215b15da22f8b4571")
        }, 
        {
            "ticketId" : "2011",
            "tUnitsSold" : 1,
            "tNetAmount" : 20,
            "tName" : "Nambey Bambey",
            "tType" : "Special",
            "expirationDate" : "20161030",
            "_id" : ObjectId("58052e0215b15da22f8b4572")
        }
    ]
}

-- 
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 https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to