Package org.dizitart.no2.collection
Interface DocumentCursor
- All Superinterfaces:
Iterable<Document>,RecordStream<Document>
The DocumentCursor represents a cursor as a stream of
Document to iterate over NitriteCollection.find() results.
It also provides methods for projection and perform left outer join with other DocumentCursor.
DocumentCursor result = collection.find();
for (Document doc : result) {
// use your logic with the retrieved doc here
}
- Since:
- 4.0
- Author:
- Anindya Chatterjee
-
Method Summary
Modifier and TypeMethodDescriptionGets a filter plan for the query.join(DocumentCursor foreignCursor, Lookup lookup) Performs a left outer join with a foreign cursor with the specified lookup parameters.Gets a lazy iterable containing all the selected keys of the result documents.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface org.dizitart.no2.common.RecordStream
firstOrNull, isEmpty, size, toList, toSet
-
Method Details
-
getFindPlan
FindPlan getFindPlan()Gets a filter plan for the query.- Returns:
- the filter plan
-
project
Gets a lazy iterable containing all the selected keys of the result documents.- Parameters:
projection- the selected keys of a result document.- Returns:
- a lazy iterable of documents.
-
join
Performs a left outer join with a foreign cursor with the specified lookup parameters.It performs an equality match on the localField to the foreignField from the documents of the foreign cursor. If an input document does not contain the localField, the join treats the field as having a value of
nullfor matching purposes.- Parameters:
foreignCursor- the foreign cursor for the join.lookup- the lookup parameter for the join operation.- Returns:
- a lazy iterable of joined documents.
- Since:
- 2.1.0
-