Uploaded image for project: 'Doctrine MongoDB ODM'
  1. Doctrine MongoDB ODM
  2. MODM-88

Selecting a subset of properties and then flushing causes database corruption

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0.0BETA2
    • Component/s: Document Manager
    • Labels:
      None

      Description

      Pretty simple to reproduce. Here is the code from our own application. All we wanted to do was to select a subset of fields from the Article document, and found that if we did that and then did anything to cause the DM to mark those documents as modified, when they get flushed to mongo it corrupts your data. For example, article has a property "published" which is set to 1, and after I run this code below, it will set the "published" property to "null" on all documents.

      $class = 'Bundle\ArticleBundle\Document\Article';
      $documents = $dm->createQuery($class)>select('_id','title','user')>execute();
      foreach($documents as $document)

      { $document->getTitle(); }

      $dm->flush();
      exit;

        Activity

        Hide
        jwage Jonathan H. Wage added a comment -

        This is not a problem anymore after the recent refactoring.

        Show
        jwage Jonathan H. Wage added a comment - This is not a problem anymore after the recent refactoring.

          People

          • Assignee:
            jwage Jonathan H. Wage
            Reporter:
            jseverson Jay Severson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: