IDocumentClient.CreateUserQuery Method

Definition

Overloads

CreateUserQuery(Uri, String, FeedOptions)

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

CreateUserQuery(Uri, SqlQuerySpec, FeedOptions)

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{dyanamic}.

CreateUserQuery(String, FeedOptions)

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

CreateUserQuery(Uri, FeedOptions)

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

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)

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

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

Parameters

documentCollectionUri
Uri

The URI of the parent document collection.

sqlExpression
String

The sql query.

feedOptions
FeedOptions

(Optional) The FeedOptions for processing the query results feed.

Returns

IQueryable<Object>

The query result set.

Applies to

CreateUserQuery(Uri, SqlQuerySpec, FeedOptions)

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

public System.Linq.IQueryable<dynamic> CreateUserQuery (Uri documentCollectionUri, 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>
Public Function CreateUserQuery (documentCollectionUri As Uri, querySpec As SqlQuerySpec, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of Object)

Parameters

documentCollectionUri
Uri

The URI of the parent document collection.

querySpec
SqlQuerySpec

The sql query.

feedOptions
FeedOptions

(Optional) The FeedOptions for processing the query results feed.

Returns

IQueryable<Object>

The query result set.

Applies to

CreateUserQuery(String, String, FeedOptions)

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

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>
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

IQueryable<Object>

an IQueryable{dynamic} that can evaluate the query.

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(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>
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

IOrderedQueryable<User>

An IOrderedQueryable{User} that can evaluate the query.

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(Uri, FeedOptions)

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

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

Parameters

documentCollectionUri
Uri

The URI of the parent document collection.

feedOptions
FeedOptions

(Optional) The FeedOptions for processing the query results feed.

Returns

IOrderedQueryable<User>

The query result set.

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>
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

IQueryable<Object>

an IQueryable{dynamic> that can evaluate the query.

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