[SERVER-30030] Create a $_internalSchemaCond MatchExpression Created: 06/Jul/17  Updated: 30/Oct/23  Resolved: 21/Jul/17

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

Type: Task Priority: Major - P3
Reporter: Kyle Suarez Assignee: Kyle Suarez
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Query 2017-07-31
Participants:

 Description   
Proposed Syntax

{ $_internalSchemaCond:
    [
        <conditionMatchExpression>,
        <thenBranchMatchExpression>,
       <elseBranchMatchExpression>
    ]
}

Proposed Semantics

A document is matched against the condition MatchExpression. If it matches, it is then matched against the thenBranch expression; otherwise, it is matched against the elseBranch expression. The document matches the entire $_internalSchemaCond expression based on whether or not it matches the thenBranch or elseBranch.

$_internalSchemaCond can be used to constrain a subobject if it is wrapped in an $_internalSchemaObjectMatch.



 Comments   
Comment by Githook User [ 21/Jul/17 ]

Author:

{u'username': u'GeertBosch', u'name': u'Geert Bosch', u'email': u'geert@mongodb.com'}

Message: SERVER-30030 Fixup missing const
Branch: master
https://github.com/mongodb/mongo/commit/6d25d033ea7b512c9f7adf36821319da284e684c

Comment by Githook User [ 21/Jul/17 ]

Author:

{u'username': u'ksuarz', u'name': u'Kyle Suarez', u'email': u'kyle.suarez@mongodb.com'}

Message: SERVER-30030 create an $_internalSchemaCond MatchExpression
Branch: master
https://github.com/mongodb/mongo/commit/d59ff1d57f7bf152d055bb05eee20684e8e3c18d

Comment by Kyle Suarez [ 06/Jul/17 ]

david.storch, let's go with your proposal of condition, thenBranch and elseBranch. I've updated the description accordingly.

I agree that the naming isn't important, but would prefer to have names over a three-element array. In the event that someone has to debug this somewhere down the line, I would want the serialized versions of these MatchExpressions to be self-documenting and obvious.

Comment by David Storch [ 06/Jul/17 ]

kyle.suarez, or condition, thenBranch, elseBranch, though I think the naming is not essential here. We could also require a three-element array. I'd be happy with any of these options.

Comment by Kyle Suarez [ 06/Jul/17 ]

My only qualm is that if, then and else will be highlighted in a non-context-aware syntax highlighter... then again, aggregation $cond uses the same words. If we really care, we could call them condition, trueBranch, and falseBranch, or something to that effect.

Generated at Thu Feb 08 04:22:28 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.