[SERVER-10561] Unset doesn't work for subarray field. Created: 19/Aug/13  Updated: 09/Jul/16  Resolved: 19/Aug/13

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: 2.4.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Phalguni Mukherjee Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows,Linux


Operating System: ALL
Steps To Reproduce:

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"

Participants:

 Description   

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.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 19/Aug/13 ]

SERVER-1243 will resolve this.

Generated at Thu Feb 08 03:23:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.