Skip to content

Commit 760ef85

Browse files
Google APIscopybara-github
authored andcommitted
feat: Expose the Database.firestore_data_access_mode parameter
feat: Expose the `Database.mongodb_compatible_data_access_mode` parameter feat: Expose the `Database.realtime_updates_mode` parameter feat: Expose the `Index.unique` parameter docs: Update documentation on several parameters, especially when relating to the new `enterprise` database edition PiperOrigin-RevId: 865444806
1 parent d077e59 commit 760ef85

File tree

13 files changed

+181
-39
lines changed

13 files changed

+181
-39
lines changed

google/firestore/admin/v1/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ proto_library(
3131
"index.proto",
3232
"location.proto",
3333
"operation.proto",
34+
"realtime_updates.proto",
3435
"schedule.proto",
3536
"snapshot.proto",
3637
"user_creds.proto",
@@ -360,6 +361,7 @@ load(
360361

361362
csharp_proto_library(
362363
name = "admin_csharp_proto",
364+
extra_opts = [],
363365
deps = [":admin_proto"],
364366
)
365367

google/firestore/admin/v1/backup.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2025 Google LLC
1+
// Copyright 2026 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

google/firestore/admin/v1/database.proto

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2025 Google LLC
1+
// Copyright 2026 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package google.firestore.admin.v1;
1818

1919
import "google/api/field_behavior.proto";
2020
import "google/api/resource.proto";
21+
import "google/firestore/admin/v1/realtime_updates.proto";
2122
import "google/protobuf/duration.proto";
2223
import "google/protobuf/timestamp.proto";
2324

@@ -65,20 +66,25 @@ message Database {
6566

6667
// Use optimistic concurrency control by default. This mode is available
6768
// for Cloud Firestore databases.
69+
//
70+
// This is the default setting for Cloud Firestore Enterprise Edition
71+
// databases.
6872
OPTIMISTIC = 1;
6973

7074
// Use pessimistic concurrency control by default. This mode is available
7175
// for Cloud Firestore databases.
7276
//
73-
// This is the default setting for Cloud Firestore.
77+
// This is the default setting for Cloud Firestore Standard Edition
78+
// databases.
7479
PESSIMISTIC = 2;
7580

7681
// Use optimistic concurrency control with entity groups by default.
7782
//
78-
// This is the only available mode for Cloud Datastore.
83+
// This mode is enabled for some databases that were automatically upgraded
84+
// from Cloud Datastore to Cloud Firestore with Datastore Mode.
7985
//
80-
// This mode is also available for Cloud Firestore with Datastore Mode but
81-
// is not recommended.
86+
// It is not recommended for any new databases, and not supported for
87+
// Firestore Native databases.
8288
OPTIMISTIC_WITH_ENTITY_GROUPS = 3;
8389
}
8490

@@ -189,7 +195,8 @@ message Database {
189195
// Encryption configuration for a new database being created from another
190196
// source.
191197
//
192-
// The source could be a [Backup][google.firestore.admin.v1.Backup] .
198+
// The source could be a [Backup][google.firestore.admin.v1.Backup] or a
199+
// [PitrSnapshot][google.firestore.admin.v1.PitrSnapshot].
193200
message EncryptionConfig {
194201
// The configuration options for using Google default encryption.
195202
message GoogleDefaultEncryptionOptions {}
@@ -241,6 +248,18 @@ message Database {
241248
ENTERPRISE = 2;
242249
}
243250

251+
// The data access mode.
252+
enum DataAccessMode {
253+
// Not Used.
254+
DATA_ACCESS_MODE_UNSPECIFIED = 0;
255+
256+
// Accessing the database through the API is allowed.
257+
DATA_ACCESS_MODE_ENABLED = 1;
258+
259+
// Accessing the database through the API is disallowed.
260+
DATA_ACCESS_MODE_DISABLED = 2;
261+
}
262+
244263
// The resource name of the Database.
245264
// Format: `projects/{project}/databases/{database}`
246265
string name = 1;
@@ -274,6 +293,10 @@ message Database {
274293
DatabaseType type = 10;
275294

276295
// The concurrency control mode to use for this database.
296+
//
297+
// If unspecified in a CreateDatabase request, this will default based on the
298+
// database edition: Optimistic for Enterprise and Pessimistic for all other
299+
// databases.
277300
ConcurrencyMode concurrency_mode = 15;
278301

279302
// Output only. The period during which past versions of data are retained in
@@ -359,4 +382,22 @@ message Database {
359382
// Immutable. The edition of the database.
360383
DatabaseEdition database_edition = 28
361384
[(google.api.field_behavior) = IMMUTABLE];
385+
386+
// Immutable. The default Realtime Updates mode to use for this database.
387+
RealtimeUpdatesMode realtime_updates_mode = 31
388+
[(google.api.field_behavior) = IMMUTABLE];
389+
390+
// Optional. The Firestore API data access mode to use for this database. If
391+
// not set on write:
392+
// - the default value is DATA_ACCESS_MODE_DISABLED for Enterprise Edition.
393+
// - the default value is DATA_ACCESS_MODE_ENABLED for Standard Edition.
394+
DataAccessMode firestore_data_access_mode = 33
395+
[(google.api.field_behavior) = OPTIONAL];
396+
397+
// Optional. The MongoDB compatible API data access mode to use for this
398+
// database. If not set on write, the default value is
399+
// DATA_ACCESS_MODE_ENABLED for Enterprise Edition. The value is always
400+
// DATA_ACCESS_MODE_DISABLED for Standard Edition.
401+
DataAccessMode mongodb_compatible_data_access_mode = 34
402+
[(google.api.field_behavior) = OPTIONAL];
362403
}

google/firestore/admin/v1/field.proto

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2025 Google LLC
1+
// Copyright 2026 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -67,10 +67,13 @@ message Field {
6767
// set.
6868
//
6969
// Storing a timestamp value into a TTL-enabled field will be treated as
70-
// the document's absolute expiration time. Timestamp values in the past
71-
// indicate that the document is eligible for immediate expiration. Using any
72-
// other data type or leaving the field absent will disable expiration for the
73-
// individual document.
70+
// the document's absolute expiration time. For Enterprise edition databases,
71+
// the timestamp value may also be stored in an array value in the
72+
// TTL-enabled field.
73+
//
74+
// Timestamp values in the past indicate that the document is eligible for
75+
// immediate expiration. Using any other data type or leaving the field absent
76+
// will disable expiration for the individual document.
7477
message TtlConfig {
7578
// The state of applying the TTL configuration to all documents.
7679
enum State {

google/firestore/admin/v1/firestore_admin.proto

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2025 Google LLC
1+
// Copyright 2026 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -538,7 +538,7 @@ message CreateDatabaseRequest {
538538
// with first character a letter and the last a letter or a number. Must not
539539
// be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.
540540
//
541-
// "(default)" database ID is also valid.
541+
// "(default)" database ID is also valid if the database is Standard edition.
542542
string database_id = 3 [(google.api.field_behavior) = REQUIRED];
543543
}
544544

@@ -943,8 +943,8 @@ message ExportDocumentsRequest {
943943
}
944944
];
945945

946-
// Which collection IDs to export. Unspecified means all collections. Each
947-
// collection ID in this list must be unique.
946+
// IDs of the collection groups to export. Unspecified means all
947+
// collection groups. Each collection group in this list must be unique.
948948
repeated string collection_ids = 2;
949949

950950
// The output URI. Currently only supports Google Cloud Storage URIs of the
@@ -987,8 +987,9 @@ message ImportDocumentsRequest {
987987
}
988988
];
989989

990-
// Which collection IDs to import. Unspecified means all collections included
991-
// in the import. Each collection ID in this list must be unique.
990+
// IDs of the collection groups to import. Unspecified means all collection
991+
// groups that were included in the export. Each collection group in this list
992+
// must be unique.
992993
repeated string collection_ids = 2;
993994

994995
// Location of the exported files.
@@ -1144,7 +1145,7 @@ message RestoreDatabaseRequest {
11441145
// with first character a letter and the last a letter or a number. Must not
11451146
// be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.
11461147
//
1147-
// "(default)" database ID is also valid.
1148+
// "(default)" database ID is also valid if the database is Standard edition.
11481149
string database_id = 2 [(google.api.field_behavior) = REQUIRED];
11491150

11501151
// Required. Backup to restore from. Must be from the same project as the
@@ -1199,7 +1200,7 @@ message CloneDatabaseRequest {
11991200
// with first character a letter and the last a letter or a number. Must not
12001201
// be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.
12011202
//
1202-
// "(default)" database ID is also valid.
1203+
// "(default)" database ID is also valid if the database is Standard edition.
12031204
string database_id = 2 [(google.api.field_behavior) = REQUIRED];
12041205

12051206
// Required. Specification of the PITR data to clone from. The source database

google/firestore/admin/v1/firestore_v1.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,15 @@ documentation:
3131
description: Gets information about a location.
3232

3333
- selector: google.cloud.location.Locations.ListLocations
34-
description: Lists information about the supported locations for this service.
34+
description: |-
35+
Lists information about the supported locations for this service.
36+
This method can be called in two ways:
37+
38+
* **List all public locations:** Use the path `GET /v1/locations`.
39+
* **List project-visible locations:** Use the path
40+
`GET /v1/projects/{project_id}/locations`. This may include public
41+
locations as well as private or other locations specifically visible
42+
to the project.
3543
3644
http:
3745
rules:
@@ -73,3 +81,4 @@ publishing:
7381
- version: google.firestore.admin.v1
7482
java_settings:
7583
library_package: com.google.cloud.firestore.v1
84+
common: {}

google/firestore/admin/v1/index.proto

Lines changed: 59 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2025 Google LLC
1+
// Copyright 2026 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -171,23 +171,65 @@ message Index {
171171
// only.
172172
DENSITY_UNSPECIFIED = 0;
173173

174-
// In order for an index entry to be added, the document must
175-
// contain all fields specified in the index.
174+
// An index entry will only exist if ALL fields are present in the document.
176175
//
177-
// This is the only allowed value for indexes having ApiScope `ANY_API` and
178-
// `DATASTORE_MODE_API`.
176+
// This is both the default and only allowed value for Standard Edition
177+
// databases (for both Cloud Firestore `ANY_API` and Cloud Datastore
178+
// `DATASTORE_MODE_API`).
179+
//
180+
// Take for example the following document:
181+
//
182+
// ```
183+
// {
184+
// "__name__": "...",
185+
// "a": 1,
186+
// "b": 2,
187+
// "c": 3
188+
// }
189+
// ```
190+
//
191+
// an index on `(a ASC, b ASC, c ASC, __name__ ASC)` will generate an index
192+
// entry for this document since `a`, 'b', `c`, and `__name__` are all
193+
// present but an index of `(a ASC, d ASC, __name__ ASC)` will not generate
194+
// an index entry for this document since `d` is missing.
195+
//
196+
// This means that such indexes can only be used to serve a query when the
197+
// query has either implicit or explicit requirements that all fields from
198+
// the index are present.
179199
SPARSE_ALL = 1;
180200

181-
// In order for an index entry to be added, the document must
182-
// contain at least one of the fields specified in the index.
183-
// Non-existent fields are treated as having a NULL value when generating
184-
// index entries.
201+
// An index entry will exist if ANY field are present in the document.
202+
//
203+
// This is used as the definition of a sparse index for Enterprise Edition
204+
// databases.
205+
//
206+
// Take for example the following document:
207+
//
208+
// ```
209+
// {
210+
// "__name__": "...",
211+
// "a": 1,
212+
// "b": 2,
213+
// "c": 3
214+
// }
215+
// ```
216+
//
217+
// an index on `(a ASC, d ASC)` will generate an index entry for this
218+
// document since `a` is present, and will fill in an `unset` value for `d`.
219+
// An index on `(d ASC, e ASC)` will not generate any index entry as neither
220+
// `d` nor `e` are present.
221+
//
222+
// An index that contains `__name__` will generate an index entry for all
223+
// documents since Firestore guarantees that all documents have a `__name__`
224+
// field.
185225
SPARSE_ANY = 2;
186226

187-
// An index entry will be added regardless of whether the
188-
// document contains any of the fields specified in the index.
189-
// Non-existent fields are treated as having a NULL value when generating
190-
// index entries.
227+
// An index entry will exist regardless of if the fields are present or not.
228+
//
229+
// This is the default density for an Enterprise Edition database.
230+
//
231+
// The index will store `unset` values for fields that are not present in
232+
// the document.
191233
DENSE = 3;
192234
}
193235

@@ -240,4 +282,8 @@ message Index {
240282

241283
// Optional. The number of shards for the index.
242284
int32 shard_count = 8 [(google.api.field_behavior) = OPTIONAL];
285+
286+
// Optional. Whether it is an unique index. Unique index ensures all values
287+
// for the indexed field(s) are unique across documents.
288+
bool unique = 10 [(google.api.field_behavior) = OPTIONAL];
243289
}

google/firestore/admin/v1/location.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2025 Google LLC
1+
// Copyright 2026 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

google/firestore/admin/v1/operation.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2025 Google LLC
1+
// Copyright 2026 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright 2026 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package google.firestore.admin.v1;
18+
19+
option csharp_namespace = "Google.Cloud.Firestore.Admin.V1";
20+
option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb";
21+
option java_multiple_files = true;
22+
option java_outer_classname = "RealtimeUpdatesProto";
23+
option java_package = "com.google.firestore.admin.v1";
24+
option objc_class_prefix = "GCFS";
25+
option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1";
26+
option ruby_package = "Google::Cloud::Firestore::Admin::V1";
27+
28+
// The Realtime Updates mode.
29+
enum RealtimeUpdatesMode {
30+
// The Realtime Updates feature is not specified.
31+
REALTIME_UPDATES_MODE_UNSPECIFIED = 0;
32+
33+
// The Realtime Updates feature is enabled by default.
34+
//
35+
// This could potentially degrade write performance for the database.
36+
REALTIME_UPDATES_MODE_ENABLED = 1;
37+
38+
// The Realtime Updates feature is disabled by default.
39+
REALTIME_UPDATES_MODE_DISABLED = 2;
40+
}

0 commit comments

Comments
 (0)