Skip to content

Commit

Permalink
Firestore: Include a trailing /documents on root resource paths (#4352)
Browse files Browse the repository at this point in the history
This is required for v1 and accepted in v1beta1.

Port of googleapis/nodejs-firestore@52c7381
  • Loading branch information
mikelehen authored and JesseLovelace committed Jan 22, 2019
1 parent c9f7d7b commit ed7bc85
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ boolean areTimestampsInSnapshotsEnabled() {

/** Returns the name of the Firestore project associated with this client. */
String getDatabaseName() {
return databasePath.toString();
return databasePath.getDatabaseName().toString();
}

/** Returns the underlying RPC client. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,8 @@ String getPath() {
*/
String getName() {
String path = getPath();

if (path.isEmpty()) {
return getDatabaseName().toString();
return getDatabaseName() + "/documents";
} else {
return getDatabaseName() + "/documents/" + getPath();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ public static RunQueryRequest query(StructuredQuery... query) {
public static RunQueryRequest query(
@Nullable ByteString transactionId, StructuredQuery... query) {
RunQueryRequest.Builder request = RunQueryRequest.newBuilder();
request.setParent(LocalFirestoreHelper.DATABASE_NAME);
request.setParent(LocalFirestoreHelper.DATABASE_NAME + "/documents");
StructuredQuery.Builder structuredQuery = request.getStructuredQueryBuilder();
structuredQuery.addFrom(
StructuredQuery.CollectionSelector.newBuilder().setCollectionId("coll"));
Expand Down

0 comments on commit ed7bc85

Please sign in to comment.