Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firestore: Include a trailing /documents on root resource paths #4352

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,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