How can I remove multiple documents in doctrine mongodb odm? In PHP class I should be able to do it using the following code:
$db->collection->remove(array("age" => 18));
How can I do it in doctrine mongo odm?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You have two options. Using the DocumentManager, you can request the collection for a given class. This will actually return a
Doctrine\MongoDB\Collectioninstance, which wraps the baseMongoCollectionto support logging and events. The underlyingMongoCollectionis available if you really want it, too:Alternatively, you can use the query builder API:
If you stop at
getQuery(), you can use thedebug()method on the returned query object to see what Doctrine will execute against the database.