Skip to main content
Version: Streamsheets 3.0

MONGO.QUERY

Gets data from your Mongo database.

Syntax

=MONGO.QUERY(Connection, Collection, QueryJSON, Target, [ResultKeys], [PageSize], [Page], [Sort], [Timeout])

Arguments

NameTypeDescription
ConnectionConnectionReference to connection used for querying. The database name is configured in the affiliated connection settings.
CollectionStringChoose an existing collection, where the item is stored.
QueryJSONJSONDefine a query using a JSON cell range, which defines the object(s) to searched for.
TargetTargetINBOX(), OUTBOX("MsgID") or a cell range where the result will be placed. Make sure the cell range is big enough or not everything is displayed.
ResultKeys (optional)RangeFilter the query result.
PageSize (optional)NumberNumber of Documents to return per page.
Page (optional)NumberIndex of page to return.
Sort (optional)Number or RangeSort query result ascending or descending. Use 1 and -1 to sort by creation time, or use a JSON cell range.
Timeout (optional)NumberDefine Timeout in seconds.

Return

TypeDescription
Boolean or ErrorTRUE, if no error.

Examples

ABCDE
1Collection:DataSet1
2GenderM
3
4_idPatientIDPatientNamePatientSurNameGender
51AF3MillerJoeM
62CF3MayerJimM
73AD4SmithJackM
FormulaResultComment
=MONGO.QUERY(MongoConnection!, B1,JSON(A2:B2),A4:E7)
TRUEAll documents in the database with the "Gender" male in the collection "TestCollection" will be shown in the range F18:N21 of the current Streamsheet. Use INBOX() as a "Target" to prevent space issues.