Skip to main content

each(_and_close)

Call a function on all documents of the cursor, and close it.

Syntax

let cursor = #db.f(query, projection)
cursor.each(fn)

or

let cursor = #db.f(query, projection)
cursor.each_and_close(fn)

Parameters

fn

The function to call. This function is called once per document, with the document passed as the only argument.

Return

Always returns undefined.

Cursor state

This function closes the cursor. If this is undesirable, try each_and_keep_open.