- 
    Type:New Feature 
- 
    Resolution: Done
- 
    Priority:Minor - P4 
- 
    Affects Version/s: None
- 
    Component/s: None
- 
    None
- 
        (copied to CRM)
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
Using method like https://api.mongodb.org/libbson/current/bson_append_int32.html, it appears that API consumers can choose the key for values not just in documents, but also in arrays. This will create BSON documents that violate the BSON spec: which says:
Array - The document for an array is a normal BSON document with integer values for the keys, starting with 0 and continuing sequentially. For example, the array ['red', 'blue'] would be encoded as the document {'0': 'red', '1': 'blue'}. The keys must be in ascending numerical order
This has caused users some problems when consuming documents created by the C driver.  See JAVA-1618.
- is related to
- 
                    SERVER-21946 when sent invalid BSON, server runs one thing and prints another in the logs -         
- Backlog
 
-         
- 
                    SERVER-16814 Validate array keys in BSON documents -         
- Backlog
 
-         
- related to
- 
                    JAVA-1618 BasicBSONList doesn't support zero-length "" key -         
- Closed
 
-         
- 
                    CDRIVER-2526 Impove the BCON_APPEND_CTX() function for being called multiple times to add multiple values to same bson array -         
- Closed
 
-