Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2938

Assignment of defaultCodecRegistry not clear in Java POJO page

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Trivial - P5 Trivial - P5
    • 3.10.0
    • Affects Version/s: None
    • Component/s: Documentation

      I'm looking at this example at http://mongodb.github.io/mongo-java-driver/3.7/bson/pojos/

      import org.bson.codecs.configuration.CodecProvider; 
      import org.bson.codecs.configuration.CodecRegistry; 
      import static org.bson.codecs.configuration.CodecRegistries.fromRegistries; 
      import static org.bson.codecs.configuration.CodecRegistries.fromProviders; 
      
      // Create a CodecRegistry containing the PojoCodecProvider instance. 
      CodecProvider pojoCodecProvider = PojoCodecProvider.builder().register("org.example.pojos").build();
       
      CodecRegistry pojoCodecRegistry = fromRegistries(
        defaultCodecRegistry, 
        fromProviders(pojoCodecProvider));
      
      

      Nowhere on this page is defaultCodeRegistry assigned.

      Maybe we add 

       

      CodecRegistry defaultCodecRegistry = MongoClientSettings.getDefaultCodecRegistry()
      

      at least for the first example?

       

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            nicholas.cottrell@mongodb.com Nic Cottrell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: