The aggregation query to execute. For regular queries, this must be null.
For aggregation queries, exactly one of this property or GqlQuery
must be set when the query is executed.
The GQL query to execute. For regular queries, exactly one of this property or Query
must be set when the query is executed. For aggregation queries,
exactly one of this property or AggregationQuery must be set when the query is executed.
The structured query to execute. For regular queries, exactly one of this property or GqlQuery
must be set when the query is executed. For aggregation queries, this must be null.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe latest version of the \u003ccode\u003eDatastoreQuery\u003c/code\u003e class in the Google Cloud Datastore v1 API is version 4.15.0.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eDatastoreQuery\u003c/code\u003e class allows for structured, GQL, or aggregation queries, with specific properties designated for each query type, using properties such as \u003ccode\u003eAggregationQuery\u003c/code\u003e, \u003ccode\u003eGqlQuery\u003c/code\u003e, and \u003ccode\u003eQuery\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThis class, \u003ccode\u003eDatastoreQuery\u003c/code\u003e, provides options for configuring read consistency using \u003ccode\u003eReadConsistency\u003c/code\u003e and profiling using \u003ccode\u003eExplainOptions\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThere are multiple previous versions of \u003ccode\u003eDatastoreQuery\u003c/code\u003e available, ranging from 4.14.0 down to 3.2.0.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eDatastoreQuery\u003c/code\u003e class can inherit methods from the base object class such as \u003ccode\u003eGetHashCode()\u003c/code\u003e, \u003ccode\u003eGetType()\u003c/code\u003e and \u003ccode\u003eToString()\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Google Cloud Datastore v1 API - Class DatastoreQuery (4.15.0)\n\nVersion latestkeyboard_arrow_down\n\n- [4.15.0 (latest)](/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.DatastoreQuery)\n- [4.14.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.14.0/Google.Cloud.Datastore.V1.DatastoreQuery)\n- [4.13.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.13.0/Google.Cloud.Datastore.V1.DatastoreQuery)\n- [4.12.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.12.0/Google.Cloud.Datastore.V1.DatastoreQuery)\n- [4.11.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.11.0/Google.Cloud.Datastore.V1.DatastoreQuery)\n- [4.10.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.10.0/Google.Cloud.Datastore.V1.DatastoreQuery)\n- [4.9.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.9.0/Google.Cloud.Datastore.V1.DatastoreQuery)\n- [4.8.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.8.0/Google.Cloud.Datastore.V1.DatastoreQuery)\n- [4.7.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.7.0/Google.Cloud.Datastore.V1.DatastoreQuery)\n- [4.6.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.6.0/Google.Cloud.Datastore.V1.DatastoreQuery)\n- [4.5.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.5.0/Google.Cloud.Datastore.V1.DatastoreQuery)\n- [4.4.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.4.0/Google.Cloud.Datastore.V1.DatastoreQuery)\n- [4.3.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.3.0/Google.Cloud.Datastore.V1.DatastoreQuery)\n- [4.2.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.2.0/Google.Cloud.Datastore.V1.DatastoreQuery)\n- [4.1.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.1.0/Google.Cloud.Datastore.V1.DatastoreQuery)\n- [4.0.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.0.0/Google.Cloud.Datastore.V1.DatastoreQuery)\n- [3.5.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/3.5.0/Google.Cloud.Datastore.V1.DatastoreQuery)\n- [3.4.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/3.4.0/Google.Cloud.Datastore.V1.DatastoreQuery)\n- [3.3.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/3.3.0/Google.Cloud.Datastore.V1.DatastoreQuery)\n- [3.2.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/3.2.0/Google.Cloud.Datastore.V1.DatastoreQuery) \n\n public sealed class DatastoreQuery\n\nReference documentation and code samples for the Google Cloud Datastore v1 API class DatastoreQuery.\n\nA Datastore query with additional options for features such as read consistency and profiling. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e DatastoreQuery \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Datastore.V1](/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.Datastore.V1.dll\n\nProperties\n----------\n\n### AggregationQuery\n\n public AggregationQuery AggregationQuery { get; set; }\n\nThe aggregation query to execute. For regular queries, this must be null.\nFor aggregation queries, exactly one of this property or [GqlQuery](/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.DatastoreQuery#Google_Cloud_Datastore_V1_DatastoreQuery_GqlQuery)\nmust be set when the query is executed.\n\n### ExplainOptions\n\n public ExplainOptions ExplainOptions { get; set; }\n\nThe profiling (explain) options to use for query execution, if any.\n\n### GqlQuery\n\n public GqlQuery GqlQuery { get; set; }\n\nThe GQL query to execute. For regular queries, exactly one of this property or [Query](/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.DatastoreQuery#Google_Cloud_Datastore_V1_DatastoreQuery_Query)\nmust be set when the query is executed. For aggregation queries,\nexactly one of this property or [AggregationQuery](/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.DatastoreQuery#Google_Cloud_Datastore_V1_DatastoreQuery_AggregationQuery) must be set when the query is executed.\n\n### Query\n\n public Query Query { get; set; }\n\nThe structured query to execute. For regular queries, exactly one of this property or [GqlQuery](/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.DatastoreQuery#Google_Cloud_Datastore_V1_DatastoreQuery_GqlQuery)\nmust be set when the query is executed. For aggregation queries, this must be null.\n\n### ReadConsistency\n\n public ReadOptions.Types.ReadConsistency? ReadConsistency { get; set; }\n\nThe level of read consistency to apply, if any. This property is ignored when the query is executed in a transaction."]]