Stay organized with collections Save and categorize content based on your preferences.
Each RPC normalizes the partition IDs of the keys in its input entities, and always returns entities with keys with normalized partition IDs. This applies to all keys and entities, including those in values, except keys with both an empty path and an empty or unset partition ID. Normalization of input keys sets the project ID (if not already set) to the project ID from the request.
v1
Package@google-cloud/datastore Constructors (constructor)(opts, gaxInstance)constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
Construct an instance of DatastoreClient.
Parameters Name Descriptionopts
ClientOptions
gaxInstance
typeof gax | typeof fallback
: loaded instance of google-gax
. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new DatastoreClient({fallback: true}, gax); ```
get apiEndpoint(): string;
The DNS address for this API service.
apiEndpointstatic get apiEndpoint(): string;
The DNS address for this API service - same as servicePath.
auth datastoreStubdatastoreStub?: Promise<{
[name: string]: Function;
}>;
descriptors
descriptors: Descriptors;
innerApiCalls
innerApiCalls: {
[name: string]: Function;
};
operationsClient
operationsClient: gax.OperationsClient;
port
static get port(): number;
The port for this API service.
scopesstatic get scopes(): string[];
The scopes needed to make gRPC calls for every method defined in this service.
servicePathstatic get servicePath(): string;
The DNS address for this API service.
universeDomainget universeDomain(): string;
warn
warn: (code: string, message: string, warnType?: string) => void;
Methods allocateIds(request, options)
allocateIds(request?: protos.google.datastore.v1.IAllocateIdsRequest, options?: CallOptions): Promise<[
protos.google.datastore.v1.IAllocateIdsResponse,
protos.google.datastore.v1.IAllocateIdsRequest | undefined,
{} | undefined
]>;
Allocates IDs for the given keys, which is useful for referencing an entity before it is inserted.
Parameters Name Descriptionrequest
protos.google.datastore.v1.IAllocateIdsRequest
The request object that will be sent.
options
CallOptions
Call options. See CallOptions for more details.
Returns Type DescriptionPromise<[ google.datastore.v1.IAllocateIdsResponse, google.datastore.v1.IAllocateIdsRequest | undefined, {} | undefined ]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The ID of the project against which to make the request.
*/
// const projectId = 'abc123'
/**
* The ID of the database against which to make the request.
* '(default)' is not allowed; please use empty string '' to refer the default
* database.
*/
// const databaseId = 'abc123'
/**
* Required. A list of keys with incomplete key paths for which to allocate
* IDs. No key may be reserved/read-only.
*/
// const keys = [1,2,3,4]
// Imports the Datastore library
const {DatastoreClient} = require('@google-cloud/datastore').v1;
// Instantiates a client
const datastoreClient = new DatastoreClient();
async function callAllocateIds() {
// Construct request
const request = {
projectId,
keys,
};
// Run request
const response = await datastoreClient.allocateIds(request);
console.log(response);
}
callAllocateIds();
allocateIds(request, options, callback)
allocateIds(request: protos.google.datastore.v1.IAllocateIdsRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.IAllocateIdsResponse, protos.google.datastore.v1.IAllocateIdsRequest | null | undefined, {} | null | undefined>): void;
Parameters Name Description request
protos.google.datastore.v1.IAllocateIdsRequest
options
CallOptions
callback
Callback<google.datastore.v1.IAllocateIdsResponse, google.datastore.v1.IAllocateIdsRequest | null | undefined, {} | null | undefined>
void
allocateIds(request, callback)
allocateIds(request: protos.google.datastore.v1.IAllocateIdsRequest, callback: Callback<protos.google.datastore.v1.IAllocateIdsResponse, protos.google.datastore.v1.IAllocateIdsRequest | null | undefined, {} | null | undefined>): void;
Parameters Name Description request
protos.google.datastore.v1.IAllocateIdsRequest
callback
Callback<google.datastore.v1.IAllocateIdsResponse, google.datastore.v1.IAllocateIdsRequest | null | undefined, {} | null | undefined>
void
beginTransaction(request, options)
beginTransaction(request?: protos.google.datastore.v1.IBeginTransactionRequest, options?: CallOptions): Promise<[
protos.google.datastore.v1.IBeginTransactionResponse,
protos.google.datastore.v1.IBeginTransactionRequest | undefined,
{} | undefined
]>;
Begins a new transaction.
Parameters Name Descriptionrequest
protos.google.datastore.v1.IBeginTransactionRequest
The request object that will be sent.
options
CallOptions
Call options. See CallOptions for more details.
Returns Type DescriptionPromise<[ google.datastore.v1.IBeginTransactionResponse, google.datastore.v1.IBeginTransactionRequest | undefined, {} | undefined ]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The ID of the project against which to make the request.
*/
// const projectId = 'abc123'
/**
* The ID of the database against which to make the request.
* '(default)' is not allowed; please use empty string '' to refer the default
* database.
*/
// const databaseId = 'abc123'
/**
* Options for a new transaction.
*/
// const transactionOptions = {}
// Imports the Datastore library
const {DatastoreClient} = require('@google-cloud/datastore').v1;
// Instantiates a client
const datastoreClient = new DatastoreClient();
async function callBeginTransaction() {
// Construct request
const request = {
projectId,
};
// Run request
const response = await datastoreClient.beginTransaction(request);
console.log(response);
}
callBeginTransaction();
beginTransaction(request, options, callback)
beginTransaction(request: protos.google.datastore.v1.IBeginTransactionRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.IBeginTransactionResponse, protos.google.datastore.v1.IBeginTransactionRequest | null | undefined, {} | null | undefined>): void;
Parameters Name Description request
protos.google.datastore.v1.IBeginTransactionRequest
options
CallOptions
callback
Callback<google.datastore.v1.IBeginTransactionResponse, google.datastore.v1.IBeginTransactionRequest | null | undefined, {} | null | undefined>
void
beginTransaction(request, callback)
beginTransaction(request: protos.google.datastore.v1.IBeginTransactionRequest, callback: Callback<protos.google.datastore.v1.IBeginTransactionResponse, protos.google.datastore.v1.IBeginTransactionRequest | null | undefined, {} | null | undefined>): void;
Parameters Name Description request
protos.google.datastore.v1.IBeginTransactionRequest
callback
Callback<google.datastore.v1.IBeginTransactionResponse, google.datastore.v1.IBeginTransactionRequest | null | undefined, {} | null | undefined>
void
cancelOperation(request, options, callback)
cancelOperation(request: protos.google.longrunning.CancelOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>, callback?: Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>): Promise<protos.google.protobuf.Empty>;
Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED
. Clients can use or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an value with a of 1, corresponding to Code.CANCELLED
.
request
protos.google.longrunning.CancelOperationRequest
The request object that will be sent.
options
CallOptions | Callback<google.protobuf.Empty, google.longrunning.CancelOperationRequest, {} | undefined | null>
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.
callback
Callback<google.longrunning.CancelOperationRequest, google.protobuf.Empty, {} | undefined | null>
The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.
Returns Type DescriptionPromise<google.protobuf.Empty>
Example
const client = longrunning.operationsClient();
await client.cancelOperation({name: ''});
close()
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Returns Type DescriptionPromise<void>
{Promise} A promise that resolves when the client is closed.
commit(request, options)commit(request?: protos.google.datastore.v1.ICommitRequest, options?: CallOptions): Promise<[
protos.google.datastore.v1.ICommitResponse,
protos.google.datastore.v1.ICommitRequest | undefined,
{} | undefined
]>;
Commits a transaction, optionally creating, deleting or modifying some entities.
Parameters Name Descriptionrequest
protos.google.datastore.v1.ICommitRequest
The request object that will be sent.
options
CallOptions
Call options. See CallOptions for more details.
Returns Type DescriptionPromise<[ google.datastore.v1.ICommitResponse, google.datastore.v1.ICommitRequest | undefined, {} | undefined ]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The ID of the project against which to make the request.
*/
// const projectId = 'abc123'
/**
* The ID of the database against which to make the request.
* '(default)' is not allowed; please use empty string '' to refer the default
* database.
*/
// const databaseId = 'abc123'
/**
* The type of commit to perform. Defaults to `TRANSACTIONAL`.
*/
// const mode = {}
/**
* The identifier of the transaction associated with the commit. A
* transaction identifier is returned by a call to
* Datastore.BeginTransaction google.datastore.v1.Datastore.BeginTransaction.
*/
// const transaction = Buffer.from('string')
/**
* Options for beginning a new transaction for this request.
* The transaction is committed when the request completes. If specified,
* TransactionOptions.mode google.datastore.v1.TransactionOptions must be
* TransactionOptions.ReadWrite google.datastore.v1.TransactionOptions.ReadWrite.
*/
// const singleUseTransaction = {}
/**
* The mutations to perform.
* When mode is `TRANSACTIONAL`, mutations affecting a single entity are
* applied in order. The following sequences of mutations affecting a single
* entity are not permitted in a single `Commit` request:
* - `insert` followed by `insert`
* - `update` followed by `insert`
* - `upsert` followed by `insert`
* - `delete` followed by `update`
* When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
* entity.
*/
// const mutations = [1,2,3,4]
// Imports the Datastore library
const {DatastoreClient} = require('@google-cloud/datastore').v1;
// Instantiates a client
const datastoreClient = new DatastoreClient();
async function callCommit() {
// Construct request
const request = {
projectId,
};
// Run request
const response = await datastoreClient.commit(request);
console.log(response);
}
callCommit();
commit(request, options, callback)
commit(request: protos.google.datastore.v1.ICommitRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.ICommitResponse, protos.google.datastore.v1.ICommitRequest | null | undefined, {} | null | undefined>): void;
Parameters Name Description request
protos.google.datastore.v1.ICommitRequest
options
CallOptions
callback
Callback<google.datastore.v1.ICommitResponse, google.datastore.v1.ICommitRequest | null | undefined, {} | null | undefined>
void
commit(request, callback)
commit(request: protos.google.datastore.v1.ICommitRequest, callback: Callback<protos.google.datastore.v1.ICommitResponse, protos.google.datastore.v1.ICommitRequest | null | undefined, {} | null | undefined>): void;
Parameters Name Description request
protos.google.datastore.v1.ICommitRequest
callback
Callback<google.datastore.v1.ICommitResponse, google.datastore.v1.ICommitRequest | null | undefined, {} | null | undefined>
void
deleteOperation(request, options, callback)
deleteOperation(request: protos.google.longrunning.DeleteOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>): Promise<protos.google.protobuf.Empty>;
Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED
.
request
protos.google.longrunning.DeleteOperationRequest
The request object that will be sent.
options
CallOptions | Callback<google.protobuf.Empty, google.longrunning.DeleteOperationRequest, {} | null | undefined>
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.
callback
Callback<google.protobuf.Empty, google.longrunning.DeleteOperationRequest, {} | null | undefined>
The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.
Returns Type DescriptionPromise<google.protobuf.Empty>
Example
const client = longrunning.operationsClient();
await client.deleteOperation({name: ''});
getOperation(request, options, callback)
getOperation(request: protos.google.longrunning.GetOperationRequest, options?: gax.CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>): Promise<[protos.google.longrunning.Operation]>;
Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
Parameters Name Descriptionrequest
protos.google.longrunning.GetOperationRequest
The request object that will be sent.
options
CallOptions | Callback<google.longrunning.Operation, google.longrunning.GetOperationRequest, {} | null | undefined>
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.
callback
Callback<google.longrunning.Operation, google.longrunning.GetOperationRequest, {} | null | undefined>
The function which will be called with the result of the API call.
The second parameter to the callback is an object representing . {Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.
Returns Type DescriptionPromise<[google.longrunning.Operation]>
Example
const client = longrunning.operationsClient();
const name = '';
const [response] = await client.getOperation({name});
// doThingsWith(response)
getProjectId()
getProjectId(): Promise<string>;
Returns Type Description Promise<string>
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter Name Description callback
Callback<string, undefined, undefined>
void
initialize()
initialize(): Promise<{
[name: string]: Function;
}>;
Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
Returns Type DescriptionPromise<{ [name: string]: Function; }>
{Promise} A promise that resolves to an authenticated service stub.
listOperationsAsync(request, options)listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.ListOperationsResponse>;
Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED
. Returns an iterable object.
For-await-of syntax is used with the iterable to recursively get response element on-demand.
Parameters Name Descriptionrequest
protos.google.longrunning.ListOperationsRequest
The request object that will be sent.
options
CallOptions
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.
Returns Type DescriptionAsyncIterable<google.longrunning.ListOperationsResponse>
{Object} An iterable Object that conforms to iteration protocols.
Example
const client = longrunning.operationsClient();
for await (const response of client.listOperationsAsync(request));
// doThingsWith(response)
lookup(request, options)
lookup(request?: protos.google.datastore.v1.ILookupRequest, options?: CallOptions): Promise<[
protos.google.datastore.v1.ILookupResponse,
protos.google.datastore.v1.ILookupRequest | undefined,
{} | undefined
]>;
Looks up entities by key.
Parameters Name Descriptionrequest
protos.google.datastore.v1.ILookupRequest
The request object that will be sent.
options
CallOptions
Call options. See CallOptions for more details.
Returns Type DescriptionPromise<[ google.datastore.v1.ILookupResponse, google.datastore.v1.ILookupRequest | undefined, {} | undefined ]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The ID of the project against which to make the request.
*/
// const projectId = 'abc123'
/**
* The ID of the database against which to make the request.
* '(default)' is not allowed; please use empty string '' to refer the default
* database.
*/
// const databaseId = 'abc123'
/**
* The options for this lookup request.
*/
// const readOptions = {}
/**
* Required. Keys of entities to look up.
*/
// const keys = [1,2,3,4]
// Imports the Datastore library
const {DatastoreClient} = require('@google-cloud/datastore').v1;
// Instantiates a client
const datastoreClient = new DatastoreClient();
async function callLookup() {
// Construct request
const request = {
projectId,
keys,
};
// Run request
const response = await datastoreClient.lookup(request);
console.log(response);
}
callLookup();
lookup(request, options, callback)
lookup(request: protos.google.datastore.v1.ILookupRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.ILookupResponse, protos.google.datastore.v1.ILookupRequest | null | undefined, {} | null | undefined>): void;
Parameters Name Description request
protos.google.datastore.v1.ILookupRequest
options
CallOptions
callback
Callback<google.datastore.v1.ILookupResponse, google.datastore.v1.ILookupRequest | null | undefined, {} | null | undefined>
void
lookup(request, callback)
lookup(request: protos.google.datastore.v1.ILookupRequest, callback: Callback<protos.google.datastore.v1.ILookupResponse, protos.google.datastore.v1.ILookupRequest | null | undefined, {} | null | undefined>): void;
Parameters Name Description request
protos.google.datastore.v1.ILookupRequest
callback
Callback<google.datastore.v1.ILookupResponse, google.datastore.v1.ILookupRequest | null | undefined, {} | null | undefined>
void
reserveIds(request, options)
reserveIds(request?: protos.google.datastore.v1.IReserveIdsRequest, options?: CallOptions): Promise<[
protos.google.datastore.v1.IReserveIdsResponse,
protos.google.datastore.v1.IReserveIdsRequest | undefined,
{} | undefined
]>;
Prevents the supplied keys' IDs from being auto-allocated by Cloud Datastore.
Parameters Name Descriptionrequest
protos.google.datastore.v1.IReserveIdsRequest
The request object that will be sent.
options
CallOptions
Call options. See CallOptions for more details.
Returns Type DescriptionPromise<[ google.datastore.v1.IReserveIdsResponse, google.datastore.v1.IReserveIdsRequest | undefined, {} | undefined ]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The ID of the project against which to make the request.
*/
// const projectId = 'abc123'
/**
* The ID of the database against which to make the request.
* '(default)' is not allowed; please use empty string '' to refer the default
* database.
*/
// const databaseId = 'abc123'
/**
* Required. A list of keys with complete key paths whose numeric IDs should
* not be auto-allocated.
*/
// const keys = [1,2,3,4]
// Imports the Datastore library
const {DatastoreClient} = require('@google-cloud/datastore').v1;
// Instantiates a client
const datastoreClient = new DatastoreClient();
async function callReserveIds() {
// Construct request
const request = {
projectId,
keys,
};
// Run request
const response = await datastoreClient.reserveIds(request);
console.log(response);
}
callReserveIds();
reserveIds(request, options, callback)
reserveIds(request: protos.google.datastore.v1.IReserveIdsRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.IReserveIdsResponse, protos.google.datastore.v1.IReserveIdsRequest | null | undefined, {} | null | undefined>): void;
Parameters Name Description request
protos.google.datastore.v1.IReserveIdsRequest
options
CallOptions
callback
Callback<google.datastore.v1.IReserveIdsResponse, google.datastore.v1.IReserveIdsRequest | null | undefined, {} | null | undefined>
void
reserveIds(request, callback)
reserveIds(request: protos.google.datastore.v1.IReserveIdsRequest, callback: Callback<protos.google.datastore.v1.IReserveIdsResponse, protos.google.datastore.v1.IReserveIdsRequest | null | undefined, {} | null | undefined>): void;
Parameters Name Description request
protos.google.datastore.v1.IReserveIdsRequest
callback
Callback<google.datastore.v1.IReserveIdsResponse, google.datastore.v1.IReserveIdsRequest | null | undefined, {} | null | undefined>
void
rollback(request, options)
rollback(request?: protos.google.datastore.v1.IRollbackRequest, options?: CallOptions): Promise<[
protos.google.datastore.v1.IRollbackResponse,
protos.google.datastore.v1.IRollbackRequest | undefined,
{} | undefined
]>;
Rolls back a transaction.
Parameters Name Descriptionrequest
protos.google.datastore.v1.IRollbackRequest
The request object that will be sent.
options
CallOptions
Call options. See CallOptions for more details.
Returns Type DescriptionPromise<[ google.datastore.v1.IRollbackResponse, google.datastore.v1.IRollbackRequest | undefined, {} | undefined ]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The ID of the project against which to make the request.
*/
// const projectId = 'abc123'
/**
* The ID of the database against which to make the request.
* '(default)' is not allowed; please use empty string '' to refer the default
* database.
*/
// const databaseId = 'abc123'
/**
* Required. The transaction identifier, returned by a call to
* Datastore.BeginTransaction google.datastore.v1.Datastore.BeginTransaction.
*/
// const transaction = Buffer.from('string')
// Imports the Datastore library
const {DatastoreClient} = require('@google-cloud/datastore').v1;
// Instantiates a client
const datastoreClient = new DatastoreClient();
async function callRollback() {
// Construct request
const request = {
projectId,
transaction,
};
// Run request
const response = await datastoreClient.rollback(request);
console.log(response);
}
callRollback();
rollback(request, options, callback)
rollback(request: protos.google.datastore.v1.IRollbackRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.IRollbackResponse, protos.google.datastore.v1.IRollbackRequest | null | undefined, {} | null | undefined>): void;
Parameters Name Description request
protos.google.datastore.v1.IRollbackRequest
options
CallOptions
callback
Callback<google.datastore.v1.IRollbackResponse, google.datastore.v1.IRollbackRequest | null | undefined, {} | null | undefined>
void
rollback(request, callback)
rollback(request: protos.google.datastore.v1.IRollbackRequest, callback: Callback<protos.google.datastore.v1.IRollbackResponse, protos.google.datastore.v1.IRollbackRequest | null | undefined, {} | null | undefined>): void;
Parameters Name Description request
protos.google.datastore.v1.IRollbackRequest
callback
Callback<google.datastore.v1.IRollbackResponse, google.datastore.v1.IRollbackRequest | null | undefined, {} | null | undefined>
void
runAggregationQuery(request, options)
runAggregationQuery(request?: protos.google.datastore.v1.IRunAggregationQueryRequest, options?: CallOptions): Promise<[
protos.google.datastore.v1.IRunAggregationQueryResponse,
protos.google.datastore.v1.IRunAggregationQueryRequest | undefined,
{} | undefined
]>;
Runs an aggregation query.
Parameters Name Descriptionrequest
protos.google.datastore.v1.IRunAggregationQueryRequest
The request object that will be sent.
options
CallOptions
Call options. See CallOptions for more details.
Returns Type DescriptionPromise<[ google.datastore.v1.IRunAggregationQueryResponse, google.datastore.v1.IRunAggregationQueryRequest | undefined, {} | undefined ]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The ID of the project against which to make the request.
*/
// const projectId = 'abc123'
/**
* The ID of the database against which to make the request.
* '(default)' is not allowed; please use empty string '' to refer the default
* database.
*/
// const databaseId = 'abc123'
/**
* Entities are partitioned into subsets, identified by a partition ID.
* Queries are scoped to a single partition.
* This partition ID is normalized with the standard default context
* partition ID.
*/
// const partitionId = {}
/**
* The options for this query.
*/
// const readOptions = {}
/**
* The query to run.
*/
// const aggregationQuery = {}
/**
* The GQL query to run. This query must be an aggregation query.
*/
// const gqlQuery = {}
/**
* Optional. Explain options for the query. If set, additional query
* statistics will be returned. If not, only query results will be returned.
*/
// const explainOptions = {}
// Imports the Datastore library
const {DatastoreClient} = require('@google-cloud/datastore').v1;
// Instantiates a client
const datastoreClient = new DatastoreClient();
async function callRunAggregationQuery() {
// Construct request
const request = {
projectId,
};
// Run request
const response = await datastoreClient.runAggregationQuery(request);
console.log(response);
}
callRunAggregationQuery();
runAggregationQuery(request, options, callback)
runAggregationQuery(request: protos.google.datastore.v1.IRunAggregationQueryRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.IRunAggregationQueryResponse, protos.google.datastore.v1.IRunAggregationQueryRequest | null | undefined, {} | null | undefined>): void;
Parameters Name Description request
protos.google.datastore.v1.IRunAggregationQueryRequest
options
CallOptions
callback
Callback<google.datastore.v1.IRunAggregationQueryResponse, google.datastore.v1.IRunAggregationQueryRequest | null | undefined, {} | null | undefined>
void
runAggregationQuery(request, callback)
runAggregationQuery(request: protos.google.datastore.v1.IRunAggregationQueryRequest, callback: Callback<protos.google.datastore.v1.IRunAggregationQueryResponse, protos.google.datastore.v1.IRunAggregationQueryRequest | null | undefined, {} | null | undefined>): void;
Parameters Name Description request
protos.google.datastore.v1.IRunAggregationQueryRequest
callback
Callback<google.datastore.v1.IRunAggregationQueryResponse, google.datastore.v1.IRunAggregationQueryRequest | null | undefined, {} | null | undefined>
void
runQuery(request, options)
runQuery(request?: protos.google.datastore.v1.IRunQueryRequest, options?: CallOptions): Promise<[
protos.google.datastore.v1.IRunQueryResponse,
protos.google.datastore.v1.IRunQueryRequest | undefined,
{} | undefined
]>;
Queries for entities.
Parameters Name Descriptionrequest
protos.google.datastore.v1.IRunQueryRequest
The request object that will be sent.
options
CallOptions
Call options. See CallOptions for more details.
Returns Type DescriptionPromise<[ google.datastore.v1.IRunQueryResponse, google.datastore.v1.IRunQueryRequest | undefined, {} | undefined ]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The ID of the project against which to make the request.
*/
// const projectId = 'abc123'
/**
* The ID of the database against which to make the request.
* '(default)' is not allowed; please use empty string '' to refer the default
* database.
*/
// const databaseId = 'abc123'
/**
* Entities are partitioned into subsets, identified by a partition ID.
* Queries are scoped to a single partition.
* This partition ID is normalized with the standard default context
* partition ID.
*/
// const partitionId = {}
/**
* The options for this query.
*/
// const readOptions = {}
/**
* The query to run.
*/
// const query = {}
/**
* The GQL query to run. This query must be a non-aggregation query.
*/
// const gqlQuery = {}
/**
* Optional. Explain options for the query. If set, additional query
* statistics will be returned. If not, only query results will be returned.
*/
// const explainOptions = {}
// Imports the Datastore library
const {DatastoreClient} = require('@google-cloud/datastore').v1;
// Instantiates a client
const datastoreClient = new DatastoreClient();
async function callRunQuery() {
// Construct request
const request = {
projectId,
};
// Run request
const response = await datastoreClient.runQuery(request);
console.log(response);
}
callRunQuery();
runQuery(request, options, callback)
runQuery(request: protos.google.datastore.v1.IRunQueryRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.IRunQueryResponse, protos.google.datastore.v1.IRunQueryRequest | null | undefined, {} | null | undefined>): void;
Parameters Name Description request
protos.google.datastore.v1.IRunQueryRequest
options
CallOptions
callback
Callback<google.datastore.v1.IRunQueryResponse, google.datastore.v1.IRunQueryRequest | null | undefined, {} | null | undefined>
void
runQuery(request, callback)
runQuery(request: protos.google.datastore.v1.IRunQueryRequest, callback: Callback<protos.google.datastore.v1.IRunQueryResponse, protos.google.datastore.v1.IRunQueryRequest | null | undefined, {} | null | undefined>): void;
Parameters Name Description request
protos.google.datastore.v1.IRunQueryRequest
callback
Callback<google.datastore.v1.IRunQueryResponse, google.datastore.v1.IRunQueryRequest | null | undefined, {} | null | undefined>
void
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4