Constructor
new FirestoreAdminClient(optionsopt)
Construct an instance of FirestoreAdminClient.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
The configuration object. The options accepted by the constructor are described in detail in this document. The common options are: Properties
|
Members
apiEndpoint
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
port
The port for this API service.
scopes
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
The DNS address for this API service.
Methods
(async) checkCreateIndexProgress(name) → {Promise}
Check the status of the long running operation returned by createIndex()
.
Parameters:
Name | Type | Description |
---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
const decodedOperation = await checkCreateIndexProgress(name);
console.log(decodedOperation.result);
console.log(decodedOperation.done);
console.log(decodedOperation.metadata);
(async) checkExportDocumentsProgress(name) → {Promise}
Check the status of the long running operation returned by exportDocuments()
.
Parameters:
Name | Type | Description |
---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
const decodedOperation = await checkExportDocumentsProgress(name);
console.log(decodedOperation.result);
console.log(decodedOperation.done);
console.log(decodedOperation.metadata);
(async) checkImportDocumentsProgress(name) → {Promise}
Check the status of the long running operation returned by importDocuments()
.
Parameters:
Name | Type | Description |
---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
const decodedOperation = await checkImportDocumentsProgress(name);
console.log(decodedOperation.result);
console.log(decodedOperation.done);
console.log(decodedOperation.metadata);
(async) checkUpdateFieldProgress(name) → {Promise}
Check the status of the long running operation returned by updateField()
.
Parameters:
Name | Type | Description |
---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
const decodedOperation = await checkUpdateFieldProgress(name);
console.log(decodedOperation.result);
console.log(decodedOperation.done);
console.log(decodedOperation.metadata);
close() → {Promise}
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Returns:
Type | Description |
---|---|
Promise |
A promise that resolves when the client is closed. |
collectionGroupPath(project, database, collection) → {string}
Return a fully-qualified collectionGroup resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
database |
string | |
collection |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
createIndex(request, optionsopt) → {Promise}
Creates a composite index. This returns a google.longrunning.Operation which may be used to track the status of the creation. The metadata for the operation will be the type IndexOperationMetadata.
Parameters:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
const [operation] = await client.createIndex(request);
const [response] = await operation.promise();
databasePath(project, database) → {string}
Return a fully-qualified database resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
database |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
deleteIndex(request, optionsopt) → {Promise}
Deletes a composite index.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Promise |
|
exportDocuments(request, optionsopt) → {Promise}
Exports a copy of all or a subset of documents from Google Cloud Firestore to another storage system, such as Google Cloud Storage. Recent updates to documents may not be reflected in the export. The export occurs in the background and its progress can be monitored and managed via the Operation resource that is created. The output of an export may only be used once the associated operation is done. If an export operation is cancelled before completion it may leave partial data behind in Google Cloud Storage.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
const [operation] = await client.exportDocuments(request);
const [response] = await operation.promise();
fieldPath(project, database, collection, field) → {string}
Return a fully-qualified field resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
database |
string | |
collection |
string | |
field |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
getField(request, optionsopt) → {Promise}
Gets the metadata and configuration for a Field.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Promise |
|
getIndex(request, optionsopt) → {Promise}
Gets a composite index.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Promise |
|
getProjectId() → {Promise}
Return the project ID used by this class.
Returns:
Type | Description |
---|---|
Promise |
A promise that resolves to string containing the project ID. |
importDocuments(request, optionsopt) → {Promise}
Imports documents into Google Cloud Firestore. Existing documents with the same name are overwritten. The import occurs in the background and its progress can be monitored and managed via the Operation resource that is created. If an ImportDocuments operation is cancelled, it is possible that a subset of the data has already been imported to Cloud Firestore.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
const [operation] = await client.importDocuments(request);
const [response] = await operation.promise();
indexPath(project, database, collection, index) → {string}
Return a fully-qualified index resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
database |
string | |
collection |
string | |
index |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
initialize() → {Promise}
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 | Description |
---|---|
Promise |
A promise that resolves to an authenticated service stub. |
listFields(request, optionsopt) → {Promise}
Lists the field configuration and metadata for this database.
Currently, FirestoreAdmin.ListFields only supports listing fields
that have been explicitly overridden. To issue this query, call
FirestoreAdmin.ListFields with the filter set to
indexConfig.usesAncestorConfig:false
.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Promise |
|
listFieldsAsync(request, optionsopt) → {Object}
Equivalent to listFields
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Object |
An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Field. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
Example
const iterable = client.listFieldsAsync(request);
for await (const response of iterable) {
// process response
}
listFieldsStream(request, optionsopt) → {Stream}
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Stream |
An object stream which emits an object representing Field on 'data' event.
The client library will perform auto-pagination by default: it will call the API as many
times as needed. Note that it can affect your quota.
We recommend using |
listIndexes(request, optionsopt) → {Promise}
Lists composite indexes.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Promise |
|
listIndexesAsync(request, optionsopt) → {Object}
Equivalent to listIndexes
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Object |
An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Index. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
Example
const iterable = client.listIndexesAsync(request);
for await (const response of iterable) {
// process response
}
listIndexesStream(request, optionsopt) → {Stream}
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Stream |
An object stream which emits an object representing Index on 'data' event.
The client library will perform auto-pagination by default: it will call the API as many
times as needed. Note that it can affect your quota.
We recommend using |
matchCollectionFromCollectionGroupName(collectionGroupName) → {string}
Parse the collection from CollectionGroup resource.
Parameters:
Name | Type | Description |
---|---|---|
collectionGroupName |
string |
A fully-qualified path representing CollectionGroup resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the collection. |
matchCollectionFromFieldName(fieldName) → {string}
Parse the collection from Field resource.
Parameters:
Name | Type | Description |
---|---|---|
fieldName |
string |
A fully-qualified path representing Field resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the collection. |
matchCollectionFromIndexName(indexName) → {string}
Parse the collection from Index resource.
Parameters:
Name | Type | Description |
---|---|---|
indexName |
string |
A fully-qualified path representing Index resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the collection. |
matchDatabaseFromCollectionGroupName(collectionGroupName) → {string}
Parse the database from CollectionGroup resource.
Parameters:
Name | Type | Description |
---|---|---|
collectionGroupName |
string |
A fully-qualified path representing CollectionGroup resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the database. |
matchDatabaseFromDatabaseName(databaseName) → {string}
Parse the database from Database resource.
Parameters:
Name | Type | Description |
---|---|---|
databaseName |
string |
A fully-qualified path representing Database resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the database. |
matchDatabaseFromFieldName(fieldName) → {string}
Parse the database from Field resource.
Parameters:
Name | Type | Description |
---|---|---|
fieldName |
string |
A fully-qualified path representing Field resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the database. |
matchDatabaseFromIndexName(indexName) → {string}
Parse the database from Index resource.
Parameters:
Name | Type | Description |
---|---|---|
indexName |
string |
A fully-qualified path representing Index resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the database. |
matchFieldFromFieldName(fieldName) → {string}
Parse the field from Field resource.
Parameters:
Name | Type | Description |
---|---|---|
fieldName |
string |
A fully-qualified path representing Field resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the field. |
matchIndexFromIndexName(indexName) → {string}
Parse the index from Index resource.
Parameters:
Name | Type | Description |
---|---|---|
indexName |
string |
A fully-qualified path representing Index resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the index. |
matchProjectFromCollectionGroupName(collectionGroupName) → {string}
Parse the project from CollectionGroup resource.
Parameters:
Name | Type | Description |
---|---|---|
collectionGroupName |
string |
A fully-qualified path representing CollectionGroup resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchProjectFromDatabaseName(databaseName) → {string}
Parse the project from Database resource.
Parameters:
Name | Type | Description |
---|---|---|
databaseName |
string |
A fully-qualified path representing Database resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchProjectFromFieldName(fieldName) → {string}
Parse the project from Field resource.
Parameters:
Name | Type | Description |
---|---|---|
fieldName |
string |
A fully-qualified path representing Field resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchProjectFromIndexName(indexName) → {string}
Parse the project from Index resource.
Parameters:
Name | Type | Description |
---|---|---|
indexName |
string |
A fully-qualified path representing Index resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
updateField(request, optionsopt) → {Promise}
Updates a field configuration. Currently, field updates apply only to
single field index configuration. However, calls to
FirestoreAdmin.UpdateField should provide a field mask to avoid
changing any configuration that the caller isn't aware of. The field mask
should be specified as: { paths: "index_config" }
.
This call returns a google.longrunning.Operation which may be used to track the status of the field update. The metadata for the operation will be the type FieldOperationMetadata.
To configure the default field settings for the database, use
the special Field
with resource name:
projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*
.
Parameters:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Promise |
|