Interface DocumentCursor

  • All Superinterfaces:
    Iterable<Document>, RecordStream<Document>

    public interface DocumentCursor
    extends 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 Detail

      • getFindPlan

        FindPlan getFindPlan()
        Gets a filter plan for the query.
        Returns:
        the filter plan
      • project

        RecordStream<Document> project​(Document projection)
        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

        RecordStream<Document> join​(DocumentCursor foreignCursor,
                                    Lookup lookup)
        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 null for 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