private JsonToken next() {
    while (state() == AbstractBsonReader.State.TYPE) {
      reader.readBsonType();
    }

    switch (state()) {
      case INITIAL:
        reader.readStartDocument();
        return JsonToken.START_OBJECT;
      case NAME:
        return JsonToken.FIELD_NAME;
      case END_OF_DOCUMENT:
        reader.readEndDocument();
        return JsonToken.END_OBJECT;
      case END_OF_ARRAY:
        reader.readEndArray();
        return JsonToken.END_ARRAY;
      case DONE:
        return null;
      case VALUE:
        return toJsonToken(type());
      default:
        throw new IllegalStateException(String.format("Unexpected state: %s currentType: %s", state(), type()));
    }
  }
The ObjectCodec used to parse the Bson object(s)
mongo/src/org/immutables/mongo/bson4jackson/BsonParser.java