-
Type: New Feature
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: 4.0.4
-
Component/s: API, Query Operations
-
None
Currently, when calling FindIterable#map, the API will only return a MongoIterable, limiting the options to further adjust the cursor after mapping it like in the following example:
MongoClient client = MongoClients.create();
MongoDatabase database = client.getDatabase("abc");
MongoCollection<Document> collection = database.getCollection("collection");
FindIterable<Document> iterable = collection.find();
MongoIterable<String> mappedIterable = iterable.map(Document::toJson);
The resulting MongoIterable now does not provide useful FindIterable methods like FindIterable#limit, FindIterable#sort and so on. I have opened up a Pull-Request for this feature on GitHub: https://github.com/mongodb/mongo-java-driver/pull/551