Skip to content

Commit ed7bc85

Browse files
mikelehenJesseLovelace
authored andcommitted
Firestore: Include a trailing /documents on root resource paths (#4352)
This is required for v1 and accepted in v1beta1. Port of googleapis/nodejs-firestore@52c7381
1 parent c9f7d7b commit ed7bc85

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FirestoreImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ boolean areTimestampsInSnapshotsEnabled() {
398398

399399
/** Returns the name of the Firestore project associated with this client. */
400400
String getDatabaseName() {
401-
return databasePath.toString();
401+
return databasePath.getDatabaseName().toString();
402402
}
403403

404404
/** Returns the underlying RPC client. */

google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/ResourcePath.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,8 @@ String getPath() {
127127
*/
128128
String getName() {
129129
String path = getPath();
130-
131130
if (path.isEmpty()) {
132-
return getDatabaseName().toString();
131+
return getDatabaseName() + "/documents";
133132
} else {
134133
return getDatabaseName() + "/documents/" + getPath();
135134
}

google-cloud-clients/google-cloud-firestore/src/test/java/com/google/cloud/firestore/LocalFirestoreHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ public static RunQueryRequest query(StructuredQuery... query) {
435435
public static RunQueryRequest query(
436436
@Nullable ByteString transactionId, StructuredQuery... query) {
437437
RunQueryRequest.Builder request = RunQueryRequest.newBuilder();
438-
request.setParent(LocalFirestoreHelper.DATABASE_NAME);
438+
request.setParent(LocalFirestoreHelper.DATABASE_NAME + "/documents");
439439
StructuredQuery.Builder structuredQuery = request.getStructuredQueryBuilder();
440440
structuredQuery.addFrom(
441441
StructuredQuery.CollectionSelector.newBuilder().setCollectionId("coll"));

0 commit comments

Comments
 (0)