Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1399

A document with same ID has two different value!

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker - P1 Blocker - P1
    • None
    • 1.10
    • None
    • None
    • Windows

    Description

      Here is psedu code :

         Cat Gor = new Cat(){ IsAlive = true};
         MongoGorCollection.Save(Gor);
         //Saving Gor as a main level document
       
         Cage CatCage = new Cage(){ Animals.AddRange( new Cat[] { Gor }  )};
         MongoCageCollection.Save(CatCage);
         //Adding Gor to Animals list of Cage as a sub-document
       
         var RetrieveGor = MongoGorCollection.FirstOrDefault();   
         RetrieveGor.IsAlive = false;
         MongoGorCollection.Save(RetrieveGor);
         //Well, we have changed IsAlive of Gor to false and saved back in DB.
         // So if I retrieve the only cat in the Cage then it must be dead.
       
         
         bool IsAliveShouldBeFalse = MongoCageCollection.FirstOrDefault().Animals.FirstOrDefault().IsAlive;
       
         //IsAliveShouldBeFalse is not false! It's true.
      

      I have checked DB with MongoVUE and I see two document with same ID has different values!

      Here is the link to screenshot :
      http://i57.tinypic.com/2qtekn7.png

      Attachments

        Activity

          People

            Unassigned Unassigned
            Mohsen7s Mohsen [X]
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: