-
Notifications
You must be signed in to change notification settings - Fork 75
Description
OS Type: Its Java - version 11
Firestore Java SDK version (1.33.0, but I can see that the problem still exists in the code on master)
Using field keys with dots (.), i.e. my.key: "My value" is allowed, albeit a bit frowned upon, has inconsistent behavior when creating compared to deleting. It is perfectly fine to create a key with dots but cannot be deleted (unless it exists on the top level of the document).
{
"my.key": true
}can be removed, but:
{
"my": {
"specialized.key": true
}
}cannot.
That's not all! Using the JavaScript SDK for Firestore, deleting is not a problem.
It is always debatable whether or not to use dots in keys, but I think the inconsistency is something that has to be fixed.
Steps to reproduce
- Create a document like the one above (with specialized.key)
- Run one of the code blocks below
var updates = Map.of("my.specialized.key", FieldValue.delete());
firestore.collection("myCollection").document("myDocument").update(updates)or
var path = new FieldPath("my", "specialized.key");
firestore.collection("myCollection").document("myDocument").update(path, FieldValue.delete()) // <-- Very similar to JavaScript SDKThe first code block will succeed without any change, but the second will result in a failed Precondition.
Code example
See steps to reproduce
Stack trace
Will fail right here:
Line 101 in 80087a3
| options.allowDelete(path), "FieldValue.delete() is not supported at field '%s'.", path); |
If you don't have time to fix this issue(? don't know if you regard this as an issue), I can definitely contribute!
Tell me if anything is unclear!