[SERVER-1013] positional $ operator field mismatch Created: 13/Apr/10  Updated: 07/Dec/15  Resolved: 07/Dec/15

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Aaron Staple Assignee: Unassigned
Resolution: Duplicate Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-14662 Positional projection queries (and po... Closed
is duplicated by SERVER-6614 When matching multiple items in inner... Closed
is duplicated by SERVER-14770 warn when more than one array is used... Closed
Related
is related to SERVER-828 Support for selecting array elements ... Closed
Participants:

 Description   

Basic issue is that the matcher records a single array position in match details without any context. There is no validation that the field path of the matched array matches the field path leading to the positional operator.

> db.f.drop()
true
> db.f.save( { a: [ 1, 2, 3 ], b: [ 4, 5, 6 ] } )
> db.f.update( { a:1,b:6 }, {$set:{'a.$':10}} )
> db.f.findOne()
{
	"_id" : ObjectId("4bc4c770e4db696f077b91d8"),
	"a" : [
		1,
		2,
		10
	],
	"b" : [
		4,
		5,
		6
	]



 Comments   
Comment by David Storch [ 07/Dec/15 ]

This has come up in a few newer tickets: SERVER-14662 and SERVER-18500. The newer tickets have more watchers and some additional discussion, so I'm closing this one as a duplicate.

Comment by Dwight Merriman [ 14/Sep/11 ]

or always set $ to the matched pos of the first sub expression

Comment by Eliot Horowitz (Inactive) [ 19/Apr/11 ]

We should probably just assert in this case.

Generated at Thu Feb 08 02:55:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.