CosmosDatabase.GetContainerQueryStreamIterator Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GetContainerQueryStreamIterator(QueryDefinition, String, QueryRequestOptions, CancellationToken) |
This method creates a query for containers under an database using a SQL statement. It returns a FeedIterator. For more information on preparing SQL statements with parameterized values, please see QueryDefinition overload. |
GetContainerQueryStreamIterator(String, String, QueryRequestOptions, CancellationToken) |
This method creates a query for containers under an database using a SQL statement. It returns a FeedIterator. For more information on preparing SQL statements with parameterized values, please see QueryDefinition overload. |
GetContainerQueryStreamIterator(QueryDefinition, String, QueryRequestOptions, CancellationToken)
This method creates a query for containers under an database using a SQL statement. It returns a FeedIterator. For more information on preparing SQL statements with parameterized values, please see QueryDefinition overload.
public abstract System.Collections.Generic.IAsyncEnumerable<Azure.Response> GetContainerQueryStreamIterator (Azure.Cosmos.QueryDefinition queryDefinition, string continuationToken = default, Azure.Cosmos.QueryRequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetContainerQueryStreamIterator : Azure.Cosmos.QueryDefinition * string * Azure.Cosmos.QueryRequestOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Azure.Response>
Public MustOverride Function GetContainerQueryStreamIterator (queryDefinition As QueryDefinition, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of Response)
Parameters
- queryDefinition
- QueryDefinition
The cosmos SQL query definition.
- continuationToken
- String
The continuation token in the Azure Cosmos DB service.
- requestOptions
- QueryRequestOptions
(Optional) The options for the container request QueryRequestOptions
- cancellationToken
- CancellationToken
(Optional) CancellationToken representing request cancellation.
Returns
An iterator to go through the containers
Examples
This create the stream feed iterator for containers with queryDefinition as input.
string queryText = "SELECT * FROM c where c.id like '%testId%'";
QueryDefinition queryDefinition = new QueryDefinition(queryText);
await foreach(Response response in this.cosmosDatabase.GetContainerQueryStreamIterator(queryDefinition))
{
using (StreamReader sr = new StreamReader(response.Content))
using (JsonTextReader jtr = new JsonTextReader(sr))
{
JObject result = JObject.Load(jtr);
}
}
Applies to
GetContainerQueryStreamIterator(String, String, QueryRequestOptions, CancellationToken)
This method creates a query for containers under an database using a SQL statement. It returns a FeedIterator. For more information on preparing SQL statements with parameterized values, please see QueryDefinition overload.
public abstract System.Collections.Generic.IAsyncEnumerable<Azure.Response> GetContainerQueryStreamIterator (string queryText = default, string continuationToken = default, Azure.Cosmos.QueryRequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetContainerQueryStreamIterator : string * string * Azure.Cosmos.QueryRequestOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Azure.Response>
Public MustOverride Function GetContainerQueryStreamIterator (Optional queryText As String = Nothing, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of Response)
Parameters
- queryText
- String
The cosmos SQL query text.
- continuationToken
- String
The continuation token in the Azure Cosmos DB service.
- requestOptions
- QueryRequestOptions
(Optional) The options for the container request QueryRequestOptions
- cancellationToken
- CancellationToken
(Optional) CancellationToken representing request cancellation.
Returns
An iterator to go through the containers
Examples
- This create the stream feed iterator for containers with queryText as input.
string queryText = "SELECT * FROM c where c.id like '%testId%'";
await foreach (Response response in this.cosmosDatabase.GetContainerQueryStreamIterator(queryText))
{
}
- This create the stream feed iterator for containers without queryText, retrieving all container.
await foreach (Response response in this.cosmosDatabase.GetContainerQueryStreamIterator())
{
}
Applies to
Azure SDK for .NET