[SERVER-31788] Reorder switch case in db/pipeline/value.cpp Created: 01/Nov/17  Updated: 06/Dec/22  Resolved: 03/Nov/17

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: 3.4.10, 3.6.0-rc2
Fix Version/s: None

Type: Task Priority: Trivial - P5
Reporter: Simon Assignee: Backlog - Query Team (Inactive)
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query
Participants:

 Description   

The method Value::compare in src/mongo/db/pipeline/value.cpp states :

    switch (lType) {
        // Order of types is the same as in BSONElement::compareElements() to make it easier to
        // verify.

Although it presents the case NumberDecimal before case NumberInt whereas it should be located after case NumberDouble to match src/mongo/bson/bsonelement.cpp.

This does not have any impact but just matches the explicit comment. Or else, just remove the comment if this is not of importance.



 Comments   
Comment by Ian Whalen (Inactive) [ 03/Nov/17 ]

Thanks for catching this, Simon. Closing this as Won't Fix just because we generally don't track these as explicit SERVER tickets but instead clean up old comments while we're touching that part of the code.

Comment by Simon [ 01/Nov/17 ]

Same for case String that should be located after case Symbol

And ideally place a default case inside the switch to match the BSONElement in case an unsupported type is added in the future (currently with verify(false); )

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