Walks a collection one element at a time and can remove the element it just returned.
Unlike a JavaScript iterator, next() returns the element itself; a cursor is not iterable, so
for…of over it is an error. Use it to filter a collection in place in one pass.
Example
constcursor = collection.cursor() while (cursor.hasNext()) { if (cursor.next() < 0) cursor.remove() }
Walks a collection one element at a time and can remove the element it just returned.
Unlike a JavaScript iterator,
next()returns the element itself; a cursor is not iterable, sofor…ofover it is an error. Use it to filter a collection in place in one pass.Example