IDocumentClient.CreateDocumentCollectionQuery 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
CreateDocumentCollectionQuery(Uri, String, FeedOptions) |
Method to create a query for document collections in the Azure Cosmos DB service. |
CreateDocumentCollectionQuery(Uri, SqlQuerySpec, FeedOptions) |
Method to create a query for document collections in the Azure Cosmos DB service. |
CreateDocumentCollectionQuery(String, String, FeedOptions) |
Overloaded. This method creates a query for collections under an Azure Cosmos DB database using a SQL statement. It returns an IQueryable{DocumentCollection}. |
CreateDocumentCollectionQuery(Uri, FeedOptions) |
Method to create a query for document collections in the Azure Cosmos DB service. |
CreateDocumentCollectionQuery(String, FeedOptions) |
Overloaded. This method creates a query for collections under an Azure Cosmos DB database. It returns An IOrderedQueryable{DocumentCollection}. |
CreateDocumentCollectionQuery(String, SqlQuerySpec, FeedOptions) |
Overloaded. This method creates a query for collections under an Azure Cosmos DB database using a SQL statement with parameterized values. It returns an IQueryable{dynamic}. For more information on preparing SQL statements with parameterized values, please see SqlQuerySpec. |
CreateDocumentCollectionQuery(Uri, String, FeedOptions)
Method to create a query for document collections in the Azure Cosmos DB service.
public System.Linq.IQueryable<dynamic> CreateDocumentCollectionQuery (Uri databaseUri, string sqlExpression, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateDocumentCollectionQuery : Uri * string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
Public Function CreateDocumentCollectionQuery (databaseUri As Uri, sqlExpression As String, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of Object)
Parameters
- databaseUri
- Uri
The URI to the database.
- sqlExpression
- String
The sql query.
- feedOptions
- FeedOptions
(Optional) The FeedOptions for processing the query results feed.
Returns
The query result set.
Remarks
Refer to https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started/ for syntax and examples.
ReadDocumentCollectionAsync(String, RequestOptions) is recommended for single documentcollection look-up.
Applies to
CreateDocumentCollectionQuery(Uri, SqlQuerySpec, FeedOptions)
Method to create a query for document collections in the Azure Cosmos DB service.
public System.Linq.IQueryable<dynamic> CreateDocumentCollectionQuery (Uri databaseUri, Microsoft.Azure.Documents.SqlQuerySpec querySpec, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateDocumentCollectionQuery : Uri * Microsoft.Azure.Documents.SqlQuerySpec * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
Public Function CreateDocumentCollectionQuery (databaseUri As Uri, querySpec As SqlQuerySpec, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of Object)
Parameters
- databaseUri
- Uri
The URI to the database.
- querySpec
- SqlQuerySpec
The sql query.
- feedOptions
- FeedOptions
(Optional) The FeedOptions for processing the query results feed.
Returns
The query result set.
Remarks
Refer to https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started/ for syntax and examples.
ReadDocumentCollectionAsync(String, RequestOptions) is recommended for single documentcollection look-up.
Applies to
CreateDocumentCollectionQuery(String, String, FeedOptions)
Overloaded. This method creates a query for collections under an Azure Cosmos DB database using a SQL statement. It returns an IQueryable{DocumentCollection}.
public System.Linq.IQueryable<dynamic> CreateDocumentCollectionQuery (string databaseLink, string sqlExpression, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateDocumentCollectionQuery : string * string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
Public Function CreateDocumentCollectionQuery (databaseLink As String, sqlExpression As String, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of Object)
Parameters
- databaseLink
- String
The link to the parent database resource.
- sqlExpression
- String
The SQL statement.
- feedOptions
- FeedOptions
The options for processing the query result feed. For details, see FeedOptions
Returns
An IQueryable{dynamic} that can evaluate the query with the provided SQL statement.
Examples
This example below queries for collections by id.
DocumentCollection collection = client.CreateDocumentCollectionQuery(databaseLink, "SELECT * FROM colls c WHERE c.id = 'mycoll'").AsEnumerable().FirstOrDefault();
Remarks
Refer to https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started/ for syntax and examples.
See also
Applies to
CreateDocumentCollectionQuery(Uri, FeedOptions)
Method to create a query for document collections in the Azure Cosmos DB service.
public System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.DocumentCollection> CreateDocumentCollectionQuery (Uri databaseUri, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateDocumentCollectionQuery : Uri * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.DocumentCollection>
Public Function CreateDocumentCollectionQuery (databaseUri As Uri, Optional feedOptions As FeedOptions = Nothing) As IOrderedQueryable(Of DocumentCollection)
Parameters
- databaseUri
- Uri
The URI of the parent database.
- feedOptions
- FeedOptions
(Optional) The FeedOptions for processing the query results feed.
Returns
The query result set.
Remarks
Refer to https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started/ for syntax and examples.
ReadDocumentCollectionAsync(String, RequestOptions) is recommended for single documentcollection look-up.
Applies to
CreateDocumentCollectionQuery(String, FeedOptions)
Overloaded. This method creates a query for collections under an Azure Cosmos DB database. It returns An IOrderedQueryable{DocumentCollection}.
public System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.DocumentCollection> CreateDocumentCollectionQuery (string databaseLink, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateDocumentCollectionQuery : string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.DocumentCollection>
Public Function CreateDocumentCollectionQuery (databaseLink As String, Optional feedOptions As FeedOptions = Nothing) As IOrderedQueryable(Of DocumentCollection)
Parameters
- databaseLink
- String
The link to the parent database resource.
- feedOptions
- FeedOptions
The options for processing the query result feed. For details, see FeedOptions
Returns
An IOrderedQueryable{DocumentCollection} that can evaluate the query with the provided SQL statement.
Examples
This example below queries for collections by id.
DocumentCollection collection = client.CreateDocumentCollectionQuery(databaseLink).Where(c => c.Id == "myColl").AsEnumerable().FirstOrDefault();
See also
Applies to
CreateDocumentCollectionQuery(String, SqlQuerySpec, FeedOptions)
Overloaded. This method creates a query for collections under an Azure Cosmos DB database using a SQL statement with parameterized values. It returns an IQueryable{dynamic}. For more information on preparing SQL statements with parameterized values, please see SqlQuerySpec.
public System.Linq.IQueryable<dynamic> CreateDocumentCollectionQuery (string databaseLink, Microsoft.Azure.Documents.SqlQuerySpec querySpec, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateDocumentCollectionQuery : string * Microsoft.Azure.Documents.SqlQuerySpec * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
Public Function CreateDocumentCollectionQuery (databaseLink As String, querySpec As SqlQuerySpec, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of Object)
Parameters
- databaseLink
- String
The link to the parent database resource.
- querySpec
- SqlQuerySpec
The SqlQuerySpec instance containing the SQL expression.
- feedOptions
- FeedOptions
The options for processing the query result feed. For details, see FeedOptions
Returns
An IQueryable{dynamic} that can evaluate the query with the provided SQL statement.
Examples
This example below queries for collections by id.
var query = new SqlQuerySpec("SELECT * FROM colls c WHERE c.id = @id", new SqlParameterCollection(new SqlParameter[] { new SqlParameter { Name = "@id", Value = "mycoll" }}));
DocumentCollection collection = client.CreateDocumentCollectionQuery(databaseLink, query).AsEnumerable().FirstOrDefault();
Remarks
Refer to https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started/ for syntax and examples.
See also
Applies to
Azure SDK for .NET