diff --git a/docstore/gcpfirestore/fs.go b/docstore/gcpfirestore/fs.go index c7527d0c92..759a8a1c1f 100644 --- a/docstore/gcpfirestore/fs.go +++ b/docstore/gcpfirestore/fs.go @@ -149,6 +149,10 @@ func CollectionResourceID(projectID, collPath string) string { return fmt.Sprintf("projects/%s/databases/(default)/documents/%s", projectID, collPath) } +func CollectionResourceIDWithDatabase(projectID, databaseID, collPath string) string { + return fmt.Sprintf("projects/%s/databases/%s/documents/%s", projectID, databaseID, collPath) +} + // OpenCollection creates a *docstore.Collection representing a Firestore collection. // // collResourceID must be of the form "project//databases/(default)/documents/". @@ -193,7 +197,7 @@ func OpenCollectionWithNameFunc(client *vkit.Client, collResourceID string, name return docstore.NewCollection(c), nil } -var resourceIDRE = regexp.MustCompile(`^(projects/[^/]+/databases/\(default\))/documents/.+`) +var resourceIDRE = regexp.MustCompile(`^(projects/[^/]+/databases/[^/]+)/documents/.+`) func newCollection(client *vkit.Client, collResourceID, nameField string, nameFunc func(docstore.Document) string, opts *Options) (*collection, error) { if nameField == "" && nameFunc == nil {