Search in sources :

Example 26 with BsonDocumentCodec

use of org.bson.codecs.BsonDocumentCodec in project mongo-java-driver by mongodb.

the class CommandMonitoringTest method getWritableCloneOfCommand.

private BsonDocument getWritableCloneOfCommand(final BsonDocument original) {
    BsonDocument clone = new BsonDocument();
    BsonDocumentWriter writer = new BsonDocumentWriter(clone);
    new BsonDocumentCodec(CODEC_REGISTRY_HACK).encode(writer, original, EncoderContext.builder().build());
    return clone;
}
Also used : BsonDocument(org.bson.BsonDocument) BsonDocumentWriter(org.bson.BsonDocumentWriter) BsonDocumentCodec(org.bson.codecs.BsonDocumentCodec)

Aggregations

BsonDocumentCodec (org.bson.codecs.BsonDocumentCodec)26 BsonDocument (org.bson.BsonDocument)9 BasicOutputBuffer (org.bson.io.BasicOutputBuffer)5 StringWriter (java.io.StringWriter)4 JsonWriter (org.bson.json.JsonWriter)4 ByteBuffer (java.nio.ByteBuffer)3 BsonBinaryReader (org.bson.BsonBinaryReader)3 MongoNamespace (com.mongodb.MongoNamespace)2 WriteConcernResult (com.mongodb.WriteConcernResult)2 BsonBinaryWriter (org.bson.BsonBinaryWriter)2 BsonDocumentWriter (org.bson.BsonDocumentWriter)2 ByteBufferBsonInput (org.bson.io.ByteBufferBsonInput)2 Test (org.junit.Test)2 MongoCursorNotFoundException (com.mongodb.MongoCursorNotFoundException)1 WriteConcernException (com.mongodb.WriteConcernException)1 BulkWriteResult (com.mongodb.bulk.BulkWriteResult)1 WriteCommandResultHelper.getBulkWriteResult (com.mongodb.connection.WriteCommandResultHelper.getBulkWriteResult)1 BsonDocumentWrapper (org.bson.BsonDocumentWrapper)1 ByteBuf (org.bson.ByteBuf)1 ByteBufNIO (org.bson.ByteBufNIO)1