private ObjectNode maybeWrap(JsonNode toChange)  {
    // BSON likes encoding full document (not simple elements like BsonValue)
    if (!toChange.isObject()) {
      toChange = mapper.createObjectNode().set("ignore", toChange);
    }

    return (ObjectNode) toChange;
  }
Read and Write in Jackson API but using BSON reader/writer adapters
criteria/mongo/test/org/immutables/criteria/mongo/bson4jackson/BsonParserTest.java