. Example of {@link Cursor}
--
// create/open a database
Nitrite db = Nitrite.builder()
.openOrCreate("user", "password");
public interface Cursor extends RecordIterable<Document>
An interface to iterate over database find()
results. It provides a
mechanism to iterate over all NitriteId
s of the result.
. Example of {@link Cursor}
--
// create/open a database
Nitrite db = Nitrite.builder()
.openOrCreate("user", "password");
// create a collection named - test NitriteCollection collection = db.getCollection("test");
// returns all ids un-filtered Cursor result = collection.find();
for (Document doc : result) { // use your logic with the retrieved doc here }
To create an iterator over the documents instead of the ids,
call on the Cursor .
|
Modifier and Type | Method and Description |
---|---|
RecordIterable<Document> |
join(Cursor foreignCursor,
Lookup lookup)
Performs a left outer join with a foreign cursor with the specified lookup parameters.
|
RecordIterable<Document> |
project(Document projection)
Gets a lazy iterable containing all the selected keys of the result documents.
|
firstOrDefault, hasMore, size, toList, totalCount
RecordIterable<Document> project(Document projection)
Gets a lazy iterable containing all the selected keys of the result documents.
projection
- the selected keys of a result document.RecordIterable<Document> join(Cursor 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.
foreignCursor
- the foreign cursor for the join.lookup
- the lookup parameter for the join operation.