Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-10561

Unset doesn't work for subarray field.

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.0
    • Component/s: Write Ops
    • None
    • Environment:
      Windows,Linux
    • ALL
    • Hide

      1. Create a collection with name "students".
      2. Insert a document as

      {
      "student_id":"123",
      "test": [

      { "date_created": "12/3/2013" }

      ]
      }
      3. Now try to unset date created for all the test objects of the student with "student_id":"123"

      Show
      1. Create a collection with name "students". 2. Insert a document as { "student_id":"123", "test": [ { "date_created": "12/3/2013" } ] } 3. Now try to unset date created for all the test objects of the student with "student_id":"123"
    • None
    • 0
    • None
    • None
    • None
    • None
    • None
    • None

      I have a collection:
      {
      "student_id":"123",
      "test": [

      { "date_created": "12/3/2013" }

      ]
      }

      I want to unset date_created for all the test object for student_id 123, I placed the query as:
      db.students.update(

      { "student_id" : "1234"}

      { "$unset" : { "test.$.date_created" : ""}}), but it doesn't work. Whereas the same query works if I want to "$set" any field.

            Assignee:
            Unassigned Unassigned
            Reporter:
            phalgunim@ripl.ricoh.com Phalguni Mukherjee
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: