[SERVER-19450] Change BSONElement::getGtLtOp() to use StringMap rather than a large if-else Created: 16/Jul/15  Updated: 23/Jun/17  Resolved: 23/Jul/15

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

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

Issue Links:
Related
related to SERVER-29814 Move BSONObj::MatchType and BSONEleme... Closed
is related to SERVER-19565 BSONElement::getGtLtOp() should inclu... Closed
Backwards Compatibility: Fully Compatible
Sprint: Quint Iteration 7
Participants:

 Description   

BSONElement::getGtLtOp() is used in query parsing to map the field name of a BSONElement to a BSONObj::MatchType (an enum which lists $-prefixed operators in the query predicate language).

Currently, the mapping is implemented as a large if-else if-else block. Instead, we should use a StringMap. This should make the code more readable, and probably faster.



 Comments   
Comment by Githook User [ 28/Jul/15 ]

Author:

{u'username': u'coollog', u'name': u'Qingyang Chen', u'email': u'qingyang.chen@10gen.com'}

Message: SERVER-19450 BSONElement::getGtLtOp() to use StringMap
Branch: master
https://github.com/mongodb/mongo/commit/8ed62df342f6451a579e16968b662cb6bb3be2aa

Comment by Githook User [ 28/Jul/15 ]

Author:

{u'username': u'coollog', u'name': u'Qingyang Chen', u'email': u'qingyang.chen@10gen.com'}

Message: SERVER-19450 UnorderedFastKeyTable/StringMap construct with std::initializer_list
Branch: master
https://github.com/mongodb/mongo/commit/84921ca797830b4adaedae01a4357d2bfccfb0a6

Comment by Githook User [ 23/Jul/15 ]

Author:

{u'username': u'coollog', u'name': u'Qingyang Chen', u'email': u'qingyang.chen@10gen.com'}

Message: SERVER-19450 BSONElement::getGtLtOp() to use StringMap
Branch: master
https://github.com/mongodb/mongo/commit/8ed62df342f6451a579e16968b662cb6bb3be2aa

Comment by Githook User [ 23/Jul/15 ]

Author:

{u'username': u'coollog', u'name': u'Qingyang Chen', u'email': u'qingyang.chen@10gen.com'}

Message: SERVER-19450 UnorderedFastKeyTable/StringMap construct with std::initializer_list
Branch: master
https://github.com/mongodb/mongo/commit/84921ca797830b4adaedae01a4357d2bfccfb0a6

Comment by David Storch [ 16/Jul/15 ]

acm, agreed. BSONObj::MatchType shouldn't be in the bson/ directory either. Moving it and changing the callers accordingly can be follow-up work.

Comment by Andrew Morrow (Inactive) [ 16/Jul/15 ]

It probably doesn't belong in BSONElement at all, really.

Generated at Thu Feb 08 03:51:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.