Share via


DocumentClient.CreateUserQuery Method

Definition

Overloads

CreateUserQuery(Uri, String, FeedOptions)

Extension method to create a query for users in the Azure Cosmos DB service.

CreateUserQuery(String, String, FeedOptions)

Overloaded. This method creates a query for users under an Azure Cosmos DB service. It returns IQueryable{dynamic}.

CreateUserQuery(Uri, SqlQuerySpec, FeedOptions)

Extension method to create a query for users in the Azure Cosmos DB service.

CreateUserQuery(Uri, FeedOptions)

Extension method to create a query for users in the Azure Cosmos DB service.

CreateUserQuery(String, FeedOptions)

Overloaded. This method creates a query for users under an Azure Cosmos DB service. It returns IOrderedQueryable{User}.

CreateUserQuery(String, SqlQuerySpec, FeedOptions)

Overloaded. This method creates a query for users 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.

CreateUserQuery(Uri, String, FeedOptions)

Extension method to create a query for users in the Azure Cosmos DB service.

public System.Linq.IQueryable<dynamic> CreateUserQuery (Uri usersUri, string sqlExpression, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateUserQuery : Uri * string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
override this.CreateUserQuery : Uri * string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
Public Function CreateUserQuery (usersUri As Uri, sqlExpression As String, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of Object)

Parameters

usersUri
Uri

the URI to the users.

sqlExpression
String

The sql query.

feedOptions
FeedOptions

The options for processing the query results feed.

Returns

The query result set.

Implements

Applies to

CreateUserQuery(String, String, FeedOptions)

Overloaded. This method creates a query for users under an Azure Cosmos DB service. It returns IQueryable{dynamic}.

public System.Linq.IQueryable<dynamic> CreateUserQuery (string usersLink, string sqlExpression, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateUserQuery : string * string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
override this.CreateUserQuery : string * string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
Public Function CreateUserQuery (usersLink As String, sqlExpression As String, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of Object)

Parameters

usersLink
String

The path link for the users under a database, e.g. dbs/db_rid/users/.

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.

Implements

Examples

This example below queries for users by id.

User user = client.CreateUserQuery(usersLink, "SELECT * FROM users u WHERE u.id = 'userid5'").AsEnumerable().FirstOrDefault();

Remarks

Refer to https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started/ for syntax and examples.

See also

Applies to

CreateUserQuery(Uri, SqlQuerySpec, FeedOptions)

Extension method to create a query for users in the Azure Cosmos DB service.

public System.Linq.IQueryable<dynamic> CreateUserQuery (Uri usersUri, Microsoft.Azure.Documents.SqlQuerySpec querySpec, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateUserQuery : Uri * Microsoft.Azure.Documents.SqlQuerySpec * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
override this.CreateUserQuery : Uri * Microsoft.Azure.Documents.SqlQuerySpec * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
Public Function CreateUserQuery (usersUri As Uri, querySpec As SqlQuerySpec, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of Object)

Parameters

usersUri
Uri

the URI to the users.

querySpec
SqlQuerySpec

The sql query.

feedOptions
FeedOptions

The options for processing the query results feed.

Returns

The query result set.

Implements

Applies to

CreateUserQuery(Uri, FeedOptions)

Extension method to create a query for users in the Azure Cosmos DB service.

public System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.User> CreateUserQuery (Uri usersUri, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateUserQuery : Uri * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.User>
override this.CreateUserQuery : Uri * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.User>
Public Function CreateUserQuery (usersUri As Uri, Optional feedOptions As FeedOptions = Nothing) As IOrderedQueryable(Of User)

Parameters

usersUri
Uri

the URI to the users.

feedOptions
FeedOptions

The options for processing the query results feed.

Returns

The query result set.

Implements

Applies to

CreateUserQuery(String, FeedOptions)

Overloaded. This method creates a query for users under an Azure Cosmos DB service. It returns IOrderedQueryable{User}.

public System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.User> CreateUserQuery (string usersLink, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateUserQuery : string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.User>
override this.CreateUserQuery : string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.User>
Public Function CreateUserQuery (usersLink As String, Optional feedOptions As FeedOptions = Nothing) As IOrderedQueryable(Of User)

Parameters

usersLink
String

The path link for the users under a database, e.g. dbs/db_rid/users/.

feedOptions
FeedOptions

The options for processing the query result feed. For details, see FeedOptions

Returns

An IOrderedQueryable{User} that can evaluate the query.

Implements

Examples

This example below queries for users by id.

User user = client.CreateUserQuery(usersLink).Where(u => u.Id == "userid5").AsEnumerable().FirstOrDefault();

See also

Applies to

CreateUserQuery(String, SqlQuerySpec, FeedOptions)

Overloaded. This method creates a query for users 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> CreateUserQuery (string usersLink, Microsoft.Azure.Documents.SqlQuerySpec querySpec, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateUserQuery : string * Microsoft.Azure.Documents.SqlQuerySpec * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
override this.CreateUserQuery : string * Microsoft.Azure.Documents.SqlQuerySpec * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
Public Function CreateUserQuery (usersLink As String, querySpec As SqlQuerySpec, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of Object)

Parameters

usersLink
String

The path link for the users under a database, e.g. dbs/db_rid/users/.

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.

Implements

Examples

This example below queries for users by id.

var query = new SqlQuerySpec(
    "SELECT * FROM users u WHERE u.id = @id", 
    new SqlParameterCollection(new SqlParameter[] { new SqlParameter { Name = "@id", Value = "userid5" }}));

User user = client.CreateUserQuery(usersLink, 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