Share via


Scripts.GetTriggerQueryIterator Method

Definition

Overloads

GetTriggerQueryIterator<T>(QueryDefinition, String, QueryRequestOptions)

This method creates a query for triggers under a container using a SQL statement with parameterized values. It returns a FeedIterator. For more information on preparing SQL statements with parameterized values, please see QueryDefinition overload.

GetTriggerQueryIterator<T>(String, String, QueryRequestOptions)

This method creates a query for triggers under a container using a SQL statement. It returns a FeedIterator.

GetTriggerQueryIterator<T>(QueryDefinition, String, QueryRequestOptions)

Source:
Scripts.cs

This method creates a query for triggers under a container using a SQL statement with parameterized values. It returns a FeedIterator. For more information on preparing SQL statements with parameterized values, please see QueryDefinition overload.

public abstract Microsoft.Azure.Cosmos.FeedIterator<T> GetTriggerQueryIterator<T> (Microsoft.Azure.Cosmos.QueryDefinition queryDefinition, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);
abstract member GetTriggerQueryIterator : Microsoft.Azure.Cosmos.QueryDefinition * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator<'T>
Public MustOverride Function GetTriggerQueryIterator(Of T) (queryDefinition As QueryDefinition, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing) As FeedIterator(Of T)

Type Parameters

T

Parameters

queryDefinition
QueryDefinition

The cosmos SQL query definition.

continuationToken
String

(Optional) The continuation token in the Azure Cosmos DB service.

requestOptions
QueryRequestOptions

(Optional) The options for the item query request.

Returns

An iterator to read through the existing stored procedures.

Examples

This create the type feed iterator for Trigger with queryDefinition as input.

Scripts scripts = this.container.Scripts;
QueryDefinition queryDefinition = new QueryDefinition("SELECT * FROM t where t.id like @testId")
    .WithParameter("@testId", "testTriggerId");
using (FeedIterator<TriggerProperties> feedIterator = this.scripts.GetTriggerQueryIterator<TriggerProperties>(queryDefinition)
{
    while (feedIterator.HasMoreResults)
    {
        foreach (var properties in await feedIterator.ReadNextAsync())
        {
            Console.WriteLine(properties.Id);
        }
    }
}

Applies to

GetTriggerQueryIterator<T>(String, String, QueryRequestOptions)

Source:
Scripts.cs

This method creates a query for triggers under a container using a SQL statement. It returns a FeedIterator.

public abstract Microsoft.Azure.Cosmos.FeedIterator<T> GetTriggerQueryIterator<T> (string queryText = default, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);
abstract member GetTriggerQueryIterator : string * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator<'T>
Public MustOverride Function GetTriggerQueryIterator(Of T) (Optional queryText As String = Nothing, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing) As FeedIterator(Of T)

Type Parameters

T

Parameters

queryText
String

The cosmos SQL query text.

continuationToken
String

(Optional) The continuation token in the Azure Cosmos DB service.

requestOptions
QueryRequestOptions

(Optional) The options for the item query request.

Returns

An iterator to read through the existing stored procedures.

Examples

This create the type feed iterator for Trigger with queryText as input.

Scripts scripts = this.container.Scripts;
using (FeedIterator<TriggerProperties> feedIterator = this.scripts.GetTriggerQueryIterator<TriggerProperties>(
    "SELECT * FROM t where t.id like '%testId%'")
{
    while (feedIterator.HasMoreResults)
    {
        foreach (var properties in await feedIterator.ReadNextAsync())
        {
            Console.WriteLine(properties.Id);
        }
    }
}

Applies to