-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Labels:
Description
Downstream Change Summary
In 4.2 find projection, it is possible to specify two paths which “collide." For example:
db.c.find({},
Unknown macro: {"a.b"}
) produces {"a" : { "b" : 1, "c" : 1 }}
In 4.4, these projections are considered illegal.
Description of Linked Ticket
Observed behavior: In the query projection implementation, the projection
{ a:1, 'a.b':1 }is equivalent to
{ 'a.b':1 }not
{ a:1 } (at least in some cases).
Expected behavior: The projection
is equivalent to
{ a:1 }.
Test:
> c.save( { a:[ 1, { b:2 }, { c:3 } ] } ) > c.find( {}, { a:1 } ) { "_id" : ObjectId("50085e465d040dc2ab6a269a"), "a" : [ 1, { "b" : 2 }, { "c" : 3 } ] } > c.find( {}, { 'a.b':1 } ) { "_id" : ObjectId("50085e465d040dc2ab6a269a"), "a" : [ { "b" : 2 }, { } ] } > c.find( {}, { a:1, 'a.b':1 } ) { "_id" : ObjectId("50085e465d040dc2ab6a269a"), "a" : [ { "b" : 2 }, { } ] }
Scope of changes
Impact to Other Docs
MVP (Work and Date)
Resources (Scope or Design Docs, Invision, etc.)
- documents
-
SERVER-6527 in projection implementation, dotted field inclusion supersedes parent field inclusion
- Closed