[JAVA-5177] Documentation error in Scala Driver examples Created: 20/Sep/23  Updated: 29/Sep/23  Resolved: 29/Sep/23

Status: Closed
Project: Java Driver
Component/s: Documentation
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Josh Smith Assignee: Rachelle Palmer
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
Duplicate
Documentation Changes Summary:

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?


 Description   

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. 



 Comments   
Comment by Ross Lawley [ 29/Sep/23 ]

Filed for fixing with the docs team.

Generated at Thu Feb 08 09:03:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.