[SERVER-29004] IDL support for enums Created: 27/Apr/17 Updated: 30/Oct/23 Resolved: 12/May/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 3.5.7 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Mark Benvenuto | Assignee: | Mark Benvenuto |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Sprint: | Platforms 2017-05-08, Platforms 2017-05-29 |
| Participants: |
| Description |
|
Enums provide a powerful way to document the values accepted by a particular field in a BSON document. The two most popular types of fields to use for enums are integer and string fields. IDL will add support for both of these two types of values for enums.
Notes:
Generates the following global type:
For string maps:
Generates the following pseudo C++ code:
A future optimization for big enums is to use a hash table instead of lots of string comparisons. Sample struct using the enums
Sample Document
Sample Pseudo C++ Generated Code:
Requested by: william.schultz |
| Comments |
| Comment by Githook User [ 12/May/17 ] |
|
Author: {u'username': u'markbenvenuto', u'name': u'Mark Benvenuto', u'email': u'mark.benvenuto@mongodb.com'}Message: |
| Comment by Githook User [ 12/May/17 ] |
|
Author: {u'username': u'markbenvenuto', u'name': u'Mark Benvenuto', u'email': u'mark.benvenuto@mongodb.com'}Message: |