[DOCS-3874] Add warning about undefined behavior cases for positional projection operator ($) Created: 06/Aug/14  Updated: 16/Mar/15  Resolved: 15/Sep/14

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: v1.3.11

Type: Improvement Priority: Minor - P4
Reporter: David Storch Assignee: Andrew Aldridge
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-14662 Positional projection queries (and po... Closed
Participants:
Days since reply: 9 years, 28 weeks ago

 Description   

Refers to SERVER-14662.

The behavior of the positional projection operator is undefined when there are multiple predicates over the projected array which are not joined by an $elemMatch. (Say the positional projection is {"a.b.$": 1}, then the "projected array" would be "a.b".)

The behavior is undefined in that you can't count on which array element will be returned by the projection. One of the predicates over the projected array will be used to match the nested document to project; if there is more than one predicate, then you don't know which one will be used for the match.

Let's add a warning to the positional projection documentation in order to discourage users from relying on this undefined behavior.


Generated at Thu Feb 08 07:46:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.