DocumentQueryable.CreateDocumentCollectionQuery Method

 

Namespace:   Microsoft.Azure.Documents.Linq
Assembly:  Microsoft.Azure.Documents.Client (in Microsoft.Azure.Documents.Client.dll)

Overload List

Name Description
System_CAPS_pubmethodSystem_CAPS_static CreateDocumentCollectionQuery(DocumentClient, String, FeedOptions)

Overloaded. This method creates create a query for collections under a database. It returns An IOrderedQueryable{DocumentCollection>.

System_CAPS_pubmethodSystem_CAPS_static CreateDocumentCollectionQuery(DocumentClient, String, SqlQuerySpec, FeedOptions)

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

System_CAPS_pubmethodSystem_CAPS_static CreateDocumentCollectionQuery(DocumentClient, String, String, FeedOptions)

Overloaded. This method creates create a query for collections under a database using a SQL statement. It returns an IQueryable{DocumentCollection}.

See Also

DocumentQueryable Class
Microsoft.Azure.Documents.Linq Namespace

Return to top

DocumentQueryable.CreateDocumentCollectionQuery Method (DocumentClient, String, FeedOptions)

Overloaded. This method creates create a query for collections under a database. It returns An IOrderedQueryable{DocumentCollection>.

Syntax

public static IOrderedQueryable<DocumentCollection> CreateDocumentCollectionQuery(
    this DocumentClient client,
    string collectionsLink,
    FeedOptions feedOptions = null
)
public:
[ExtensionAttribute]
static IOrderedQueryable<DocumentCollection^>^ CreateDocumentCollectionQuery(
    DocumentClient^ client,
    String^ collectionsLink,
    FeedOptions^ feedOptions = null
)
<ExtensionAttribute>
Public Shared Function CreateDocumentCollectionQuery (
    client As DocumentClient,
    collectionsLink As String,
    feedOptions As FeedOptions
) As IOrderedQueryable(Of DocumentCollection)

Parameters

  • collectionsLink
    Type: System.String

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

Return Value

Type: System.Linq.IOrderedQueryable<DocumentCollection>

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

DocumentCollection
IDocumentQuery

Return to top

DocumentQueryable.CreateDocumentCollectionQuery Method (DocumentClient, String, SqlQuerySpec, FeedOptions)

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

Syntax

public static IQueryable<object> CreateDocumentCollectionQuery(
    this DocumentClient client,
    string collectionsLink,
    SqlQuerySpec querySpec,
    FeedOptions feedOptions = null
)
public:
[ExtensionAttribute]
static IQueryable<Object^>^ CreateDocumentCollectionQuery(
    DocumentClient^ client,
    String^ collectionsLink,
    SqlQuerySpec^ querySpec,
    FeedOptions^ feedOptions = null
)
<ExtensionAttribute>
Public Shared Function CreateDocumentCollectionQuery (
    client As DocumentClient,
    collectionsLink As String,
    querySpec As SqlQuerySpec,
    feedOptions As FeedOptions
) As IQueryable(Of Object)

Parameters

  • collectionsLink
    Type: System.String

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

Return Value

Type: System.Linq.IQueryable<Object>

An IQueryable{dynamic} that can evaluate the query with the provided SQL statement.

Remarks

Refer to https://msdn.microsoft.com/en-us/library/azure/dn782250.aspx and https://azure.microsoft.com/documentation/articles/documentdb-sql-query/ for syntax and examples.

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

See Also

DocumentCollection
IDocumentQuery

Return to top

DocumentQueryable.CreateDocumentCollectionQuery Method (DocumentClient, String, String, FeedOptions)

Overloaded. This method creates create a query for collections under a database using a SQL statement. It returns an IQueryable{DocumentCollection}.

Syntax

public static IQueryable<object> CreateDocumentCollectionQuery(
    this DocumentClient client,
    string collectionsLink,
    string sqlExpression,
    FeedOptions feedOptions = null
)
public:
[ExtensionAttribute]
static IQueryable<Object^>^ CreateDocumentCollectionQuery(
    DocumentClient^ client,
    String^ collectionsLink,
    String^ sqlExpression,
    FeedOptions^ feedOptions = null
)
<ExtensionAttribute>
Public Shared Function CreateDocumentCollectionQuery (
    client As DocumentClient,
    collectionsLink As String,
    sqlExpression As String,
    feedOptions As FeedOptions
) As IQueryable(Of Object)

Parameters

  • collectionsLink
    Type: System.String

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

Return Value

Type: System.Linq.IQueryable<Object>

An IQueryable{dynamic} that can evaluate the query with the provided SQL statement.

Remarks

Refer to https://msdn.microsoft.com/en-us/library/azure/dn782250.aspx and https://azure.microsoft.com/documentation/articles/documentdb-sql-query/ for syntax and examples.

Examples

This example below queries for collections by id.

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

See Also

DocumentCollection
IDocumentQuery

Return to top