They both do this by calling EncoderContext.isEncodingCollectibleDocument(true).
BsonDocument#toJson, inconsistently, does not do any re-ordering.
I think the current behavior is wrong, as there are situations where this reordering is incorrect, e.g. for MongoDB index specifications.