你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

DocumentClient.CreateDocumentCollectionQuery 方法

定义

重载

CreateDocumentCollectionQuery(String, FeedOptions)

已重载。 此方法为 Azure Cosmos DB 数据库下的集合创建查询。 它返回 IOrderedQueryable{DocumentCollection}。

CreateDocumentCollectionQuery(Uri, FeedOptions)

用于在 Azure Cosmos DB 服务中创建文档集合查询的扩展方法。

CreateDocumentCollectionQuery(String, SqlQuerySpec, FeedOptions)

已重载。 此方法使用具有参数化值的 SQL 语句为 Azure Cosmos DB 数据库下的集合创建查询。 它返回 IQueryable{dynamic}。 有关使用参数化值准备 SQL 语句的详细信息,请参阅 SqlQuerySpec

CreateDocumentCollectionQuery(String, String, FeedOptions)

已重载。 此方法使用 SQL 语句为 Azure Cosmos DB 数据库下的集合创建查询。 它返回 IQueryable{DocumentCollection}。

CreateDocumentCollectionQuery(Uri, SqlQuerySpec, FeedOptions)

用于在 Azure Cosmos DB 服务中创建文档集合查询的扩展方法。

CreateDocumentCollectionQuery(Uri, String, FeedOptions)

用于在 Azure Cosmos DB 服务中创建文档集合查询的扩展方法。

CreateDocumentCollectionQuery(String, FeedOptions)

已重载。 此方法为 Azure Cosmos DB 数据库下的集合创建查询。 它返回 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>
override this.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)

参数

databaseLink
String

指向父数据库资源的链接。

feedOptions
FeedOptions

用于处理查询结果源的选项。 有关详细信息,请参阅 FeedOptions

返回

可以使用提供的 SQL 语句评估查询的 IOrderedQueryable{DocumentCollection}。

实现

示例

以下示例按 ID 查询集合。

DocumentCollection collection = client.CreateDocumentCollectionQuery(databaseLink).Where(c => c.Id == "myColl").AsEnumerable().FirstOrDefault();

注解

有关语法和示例, https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started/ 请参阅 。 ReadDocumentCollectionAsync(Uri, RequestOptions) 建议用于单个 documentcollection 查找。

另请参阅

适用于

CreateDocumentCollectionQuery(Uri, FeedOptions)

用于在 Azure Cosmos DB 服务中创建文档集合查询的扩展方法。

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>
override this.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)

参数

databaseUri
Uri

数据库的 URI。

feedOptions
FeedOptions

用于处理查询结果源的选项。

返回

查询结果集。

实现

适用于

CreateDocumentCollectionQuery(String, SqlQuerySpec, FeedOptions)

已重载。 此方法使用具有参数化值的 SQL 语句为 Azure Cosmos DB 数据库下的集合创建查询。 它返回 IQueryable{dynamic}。 有关使用参数化值准备 SQL 语句的详细信息,请参阅 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>
override this.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)

参数

databaseLink
String

指向父数据库资源的链接。

querySpec
SqlQuerySpec

包含 SQL 表达式的 SqlQuerySpec 实例。

feedOptions
FeedOptions

用于处理查询结果源的选项。 有关详细信息,请参阅 FeedOptions

返回

可以使用提供的 SQL 语句评估查询的 IQueryable{dynamic}。

实现

示例

以下示例按 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();

注解

有关语法和示例, https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started/ 请参阅 。

ReadDocumentCollectionAsync(String, RequestOptions) 建议用于单个 documentcollection 查找。

另请参阅

适用于

CreateDocumentCollectionQuery(String, String, FeedOptions)

已重载。 此方法使用 SQL 语句为 Azure Cosmos DB 数据库下的集合创建查询。 它返回 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>
override this.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)

参数

databaseLink
String

指向父数据库资源的链接。

sqlExpression
String

SQL 语句。

feedOptions
FeedOptions

用于处理查询结果源的选项。 有关详细信息,请参阅 FeedOptions

返回

可以使用提供的 SQL 语句评估查询的 IQueryable{dynamic}。

实现

示例

以下示例按 ID 查询集合。

DocumentCollection collection = client.CreateDocumentCollectionQuery(databaseLink, "SELECT * FROM colls c WHERE c.id = 'mycoll'").AsEnumerable().FirstOrDefault();

注解

有关语法和示例, https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started/ 请参阅 。

ReadDocumentCollectionAsync(Uri, RequestOptions) 建议用于单个 documentcollection 查找。

另请参阅

适用于

CreateDocumentCollectionQuery(Uri, SqlQuerySpec, FeedOptions)

用于在 Azure Cosmos DB 服务中创建文档集合查询的扩展方法。

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>
override this.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)

参数

databaseUri
Uri

数据库的 URI。

querySpec
SqlQuerySpec

sql 查询。

feedOptions
FeedOptions

用于处理查询结果源的选项。

返回

查询结果集。

实现

适用于

CreateDocumentCollectionQuery(Uri, String, FeedOptions)

用于在 Azure Cosmos DB 服务中创建文档集合查询的扩展方法。

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>
override this.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)

参数

databaseUri
Uri

数据库的 URI。

sqlExpression
String

sql 查询。

feedOptions
FeedOptions

用于处理查询结果源的选项。

返回

查询结果集。

实现

适用于