firebase-js-sdk icon indicating copy to clipboard operation
firebase-js-sdk copied to clipboard

Cannot update backticked nested field, when it contains / (slash)

Open MarkChrisLevy opened this issue 1 year ago • 3 comments

Operating System

MacOS

Environment (if applicable)

Chrome 131

Firebase SDK Version

11.0.2

Firebase SDK Product(s)

Firestore

Project Tooling

Solid.js

Detailed Problem Description

Firestore allows to have a map field, whose keys contains slashes, e.g. abc/def/123. You can write a document from js sdk with that kind of fields and keys, however if updating doc with nested field dot notation it throws error: Paths must not contain '~', '*', '/', '[', or ']'. The docs says: A quoted field name starts and ends with the backtick character. For example, foo.`x&y` refers to the x&y field nested under the foo field.

I know that FieldPath can be used and it works with FieldPaths, but it should work also with backticks.

Steps and code to reproduce issue

updateDoc(doc(getFirestore(), "doc123"), {["abc.`def/123/455`"]: true})

MarkChrisLevy avatar Nov 30 '24 18:11 MarkChrisLevy

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar Nov 30 '24 18:11 google-oss-bot

We added this to our backlog and will address this when there is an opportunity. In the meantime, please use the FieldPath workaround, thanks.

Internal tracking: b/391366877

wu-hui avatar Jan 21 '25 17:01 wu-hui

What is the workaround?

goranovs avatar Apr 26 '25 17:04 goranovs