-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Server Programmability
basic_types.idl currently exports safeInt/safeInt64 types for numbers, and the latter two can accept either BSON int or BSON long values during parse, but when serializing, they explicitly store a single given type (int for safeInt or int64_t for safeInt64).
Some commands such as count want to serialize as a BSON int when the value can fit into int32_t, or a BSON long when the value is larger. A standard IDL type which uses the BSONObjBuilder::appendNumber overload to select the encoded type based on value would simplify TypedCommand reply structures.