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 = null);
abstract member CreateUserQuery : Uri * string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>

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

The query result set.

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 = null);
abstract member CreateUserQuery : Uri * Microsoft.Azure.Documents.SqlQuerySpec * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>

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

The query result set.

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 = null);
abstract member CreateUserQuery : string * string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>

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.

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://msdn.microsoft.com/en-us/library/azure/dn782250.aspx and http://azure.microsoft.com/documentation/articles/documentdb-sql-query/ for syntax and examples.

See also

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 = null);
abstract member CreateUserQuery : string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.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.

Examples

This example below queries for users by id.


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

See also

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 = null);
abstract member CreateUserQuery : Uri * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.User>

Parameters

documentCollectionUri
Uri

The URI of the parent document collection.

feedOptions
FeedOptions

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

Returns

The query result set.

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 = null);
abstract member CreateUserQuery : string * Microsoft.Azure.Documents.SqlQuerySpec * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>

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.

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://msdn.microsoft.com/en-us/library/azure/dn782250.aspx and http://azure.microsoft.com/documentation/articles/documentdb-sql-query/ for syntax and examples.

See also

Applies to