Skip to content

Add mergeOptions support for Firestore set operation#2165

Merged
TheNoumanDev merged 1 commit intomainfrom
firestore_merge_operation
Feb 21, 2026
Merged

Add mergeOptions support for Firestore set operation#2165
TheNoumanDev merged 1 commit intomainfrom
firestore_merge_operation

Conversation

@TheNoumanDev
Copy link
Member

@TheNoumanDev TheNoumanDev commented Feb 21, 2026

Summary

  • Adds mergeOptions property to Firestore set operation
  • Supports merge: true and mergeFields: [...] options
  • mergeFields takes priority if both are provided
  • By default merge is false, when mergeOptions isn't defined for backward compatibility

The benefit of using merge is that if the document doesn't exist, it creates the new document with the given fields, but if the document already exists, it just updates the given field, while the rest remain the same.

Example Usage

# merge: true - merges all passed fields, preserves existing
myAPI:
  type: firestore
  path: users/user123
  operation: set
  mergeOptions:
    merge: true
  data:
    name: "John"
    email: "john@example.com"

# mergeFields - only writes specified fields useful with form fields data or api response.
myAPI:
  type: firestore
  path: users/user123
  operation: set
  mergeOptions:
    mergeFields:
      - name
      - updatedAt
  data:
    name: "John"
    email: "ignored"
    updatedAt: ${FieldValue.serverTimestamp()}

Once approved, then before merging i will add the docs, schema, and Kitchen Sink Example.

Schema PR: https://github.com/EnsembleUI/ensemble-web-studio/pull/1725
Docs: EnsembleUI/ensemble_docs#98 (comment)
Also updated Kitchen Sink Example

@TheNoumanDev TheNoumanDev merged commit 59e6a72 into main Feb 21, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants