private boolean hasBeenSerializedAsPrimitive(BsonDocument document) { byte[] bytes = document.toByteArray(); return bytes.length == 1 || bytes.length != bytes[0]; }
private DBObject convertToDBObject(Object pojo, Object id) { BsonDocument document = marshallDocument(pojo); DBObject dbo = new AlreadyCheckedDBObject(document.toByteArray(), id); dbo.put("_id", id); return dbo; }