Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8178443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:46:07+00:00 2026-06-06T23:46:07+00:00

How can I remove multiple documents in doctrine mongodb odm? In PHP class I

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:46:08+00:00Added an answer on June 6, 2026 at 11:46 pm

    You have two options. Using the DocumentManager, you can request the collection for a given class. This will actually return a Doctrine\MongoDB\Collection instance, which wraps the base MongoCollection to support logging and events. The underlying MongoCollection is available if you really want it, too:

    $collection = $dm->getDocumentCollection('Documents\User');
    $collection->remove(array('age' => 18));
    
    // Use the raw MongoCollection to bypass logging and events
    $mongoCollection = $collection->getMongoCollection();
    $mongoCollection->remove(array('age' => 18));
    

    Alternatively, you can use the query builder API:

    $qb = $dm->createQueryBuilder('Documents\User');
    $qb->remove()
        ->field('age')->equals(18)
        ->getQuery()
        ->execute();
    

    If you stop at getQuery(), you can use the debug() method on the returned query object to see what Doctrine will execute against the database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Greetings, I am attempting to remove multiple documents from a MongoDB collection using the
How can I remove multiple references to the property statement in my Link class?
One can remove all calls to printf() using #define printf . What if I
I was wondering if when using the datagridview control you can remove the thing
Is there any way in C to remove (using remove() ) multiple files using
Can someone help point me in the direction of changing multiple inline styles using
we can remove formula from one cell by cell.setCellFormula(null) . but if i want
How we can remove an array entry from : var a = [],b =
How to I can remove posts from a specific category from homepages in wordpress?
Is there a way I can remove the background bar image in the SeekBar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.