Currently can't round trip
byte[] data = [65, 66, 82, 87, 84, 73, 70, 71, 80, 69, 101, 83, 70, 102, 54, 57, 102, 73, 83, 65, 79, 65, 61, 61] byte type = 0x03 def binary = new Binary(type, data) def document = new BasicDBObject("_id", binary) def encoder = new BasicBSONEncoder() def decoder = new BasicBSONDecoder() def callback = new BasicBSONCallback(); then: def encoded = encoder.encode(document) decoder.decode(encoded, callback) // FAILS