Returns the query plan for the SQL query.
Executs the query. This returns the raw response and definitions.
You can use the sql tagged template literal for easy querying,
and you can use $self
placeholder in the string to refer to the
current collection.
Shape of returned data, defaults to the interface on the model
Runs the query and returns its output in fulfilled models.
You can use the sql tagged template literal for easy querying,
and you can use $self
placeholder in the string to refer to the
current collection.
const r = User.crossPartitionQuery().run(
sql`SELECT c.* FROM $self c WHERE username = ${name}`);
for await (const { resources } of r.getAsyncIterator()){
for (const model of resources) {
model.coolness++;
await model.save();
}
}
Generated using TypeDoc
The Query is a helper for running queries in a Cosmos DB collection. It can be acquired from Partition.query or the static
Model.crossPartitionQuery
method.