Writes an arbitrary Kotlin obj into a top-level BSON document.
Prefer using BsonContext.write.
A top-level BSON document cannot be null, cannot be a primitive, and cannot be a collection. If obj is not representable as a document, an exception is thrown.