Firestore Document: Create a Firestore document with a VectorValue field:
{
"name": "My Document",
"embeddingVector": [1.0, 2.0, 3.0] // Example vector
}
Security Rules: Implement rules that allow updates only to the name field, use affectedKeys():
function editingOnlyAllowedFields(allowedFields) {
let editedKeys = request.resource.data.diff(resource.data).affectedKeys();
return editedKeys.hasOnly(allowedFields);
}
allow update: if editingOnlyAllowedFields(['name']);
<!-- Provide a minimal, complete, and verifiable example (http://stackoverflow.com/help/mcve) -->
### [REQUIRED] Steps to reproduce
Update the Document: Attempt to update the document, changing the `name` field:
{
"name": "My Document Updated"
}
<!-- Provide the steps needed to reproduce the issue with the above test case. -->
### [REQUIRED] Expected behavior
The expected behavior is for the rules to return `true` for update and the `affectedKeys` function to work with the `VectorValue` field.
<!-- What is the expected behavior? -->
### [REQUIRED] Actual behavior
FirebaseError: PERMISSION_DENIED:
evaluation error at L193:30 for 'create' @ L193, evaluation error at L189:30 for 'update' @ L189, Unsupported value type VECTOR for 'update' @ L189
<!-- Run the command with --debug flag, and include the logs below. -->
[REQUIRED] Environment info
firebase-tools: 13.11.2
Platform: Windows
[REQUIRED] Test case
Here's a test case that demonstrates the issue:
VectorValue
field:name
field, use affectedKeys():allow update: if editingOnlyAllowedFields(['name']);
{ "name": "My Document Updated" }
FirebaseError: PERMISSION_DENIED: evaluation error at L193:30 for 'create' @ L193, evaluation error at L189:30 for 'update' @ L189, Unsupported value type VECTOR for 'update' @ L189