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

Documentation error in Scala Driver examples

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Documentation
    • Labels:
      None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      The document for how to print out the results of a collection when doing a read found here 

      https://mongodb.github.io/mongo-java-driver/4.10/driver-scala/tutorials/perform-read-operations/

      are in accurate.  Trying to execute that code as defines produces this error. 

       

       

      value printReesults is not a member of org.mongodb.scala.FindObservable[org.mongodb.scala.bson.Document]
            collection.find().printResults()
       
      

      The top of the documentation even mentions that it uses the Observable pattern, but then the examples don't use it.   The accurate code seems to be something closer to 

       

      collection.find().subscribe( (document: Document) => println(document.toJson())) 

      This creates confusion for our customers that are trying to use the documentation to get things up and working. 

            Assignee:
            rachelle.palmer@mongodb.com Rachelle Palmer
            Reporter:
            josh.smith@mongodb.com Josh Smith
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: