[SERVER-12107] updates not working at deeper level of array/object Created: 16/Dec/13  Updated: 10/Dec/14  Resolved: 17/Dec/13

Status: Closed
Project: Core Server
Component/s: Querying, Write Ops
Affects Version/s: 2.5.4
Fix Version/s: None

Type: Bug Priority: Blocker - P1
Reporter: shravan Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

all


Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

see description

Participants:

 Description   

FOR a given DOCUMENT, where i have a unique sub document, which i want to update ..

{
 id:1,
 a:[
     {
        id:2,
        b:[
            {
                id:3,
                c:[
                    {
                        id:4,
                        d:["x","y"]
                    },
                    {
                        id:5,
                        d:["p","q"]
                    }
                ]
            },
            {
                id:13,
                c:[
                    {
                        id:14,
                        d:["w","q"]
                    },
                    {
                        id:15,
                        d:["i","j"]
                    }
                ]
            }           
        ]   
     }
 ]
} 

FOR this document you cannot update d to d:["x","y","z"] ;

PROPOSED change to update using PLACEMARKERS $as : $1 / $2 to the matched location rather $elemMatch
NOTE : this is the proposed change .. beeter ways could be provided.

db.coll.update({
 id:1,
 a:[
     {
        id:2,
	$as:1	
        b:[
            {
                id:3,
                c:[
                    {
                        id:4,
			$as:2			
		    }
                   ]	
              }
           ]
        }
     ]     
},
{
   $addToSet:{$2:{"d":["z"]}}	
}
);

PLEASE SEE $elemMatch or any other operator doesn't work here ..
even if i have the unique path to my subdocument. Which matches a single element .. i cannot update.. this is the BIGGEST feature gap.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 17/Dec/13 ]

I believe you are proposing something very similar to SERVER-831, which is something we're going to be working on.

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