[DOCS-13638] Java driver docs refer to old MongoIterable#forEach(Block<T>) Created: 11/May/20 Updated: 29/Oct/23 Resolved: 16/Jun/20 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | drivers |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Torsten Spindler | Assignee: | Christopher Cho |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | java-driver | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: | |
| Days since reply: | 3 years, 34 weeks, 4 days ago |
| Story Points: | 2 |
| Description |
DescriptionHello, our documentation pages at https://docs.mongodb.com/guides/server/read/ for Java and also http://mongodb.github.io/mongo-java-driver/4.0/driver/tutorials/perform-read-operations/ refer to the old forEach printBlock method, which no longer works. I worked around the issue via the built-in Java 8 forEach and this consumer:
Scope of changesImpact to Other DocsMVP (Work and Date)Resources (Scope or Design Docs, Invision, etc.) |
| Comments |
| Comment by Githook User [ 13/Jun/20 ] |
|
Author: {'name': 'Chris Cho', 'email': 'chris.cho@10gen.com', 'username': 'ccho-mongodb'}Message: |
| Comment by Cloud GitHub Webhooks [ 13/Jun/20 ] |
|
jyemin merged a pull request (DOCS-13638 replace Block with Consumer) into the following branch: |
| Comment by Christopher Cho [ 13/May/20 ] |
|
Guides PR: https://github.com/10gen/docs-tutorials/pull/153
Java docs PR: |
| Comment by Jeffrey Yemin [ 12/May/20 ] |
|
It's an issue. Since the 3.x driver supports Java 6+, and Iterable.forEach was added in Java 8, the driver's MongoIterable interface defined our own forEach method that used this Block interface that the driver itself defined. But when running on Java 8, you automatically pick up Iterable's version, which uses an interface called Consumer. In the 4.0 driver we got rid of the driver's forEach method, and now you have to use the one from Iterable. So all the printBlock code should be updated to use Consumer instead of Block |