[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: |
|
||||||||||||
| 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: |
| 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: |
| 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: |
| 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: |
| 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. |