This pull request enhances our Firestore to Typesense synchronization by adding support for nested field extraction. It allows users to specify nested fields using dot notation, making it easier to sync complex data structures from Firestore to Typesense.
Rationale
This change resolves issue #90, which requests dot notation support for the "Firestore Collection Fields" parameter. By implementing this feature, we enable users to access any level property on fields they want to explicitly include in the trigger.
Changes
Added Features:
New dependency in functions/package.json:
Added lodash.get (version 4.4.2) for safe nested property access.
Code Changes:
In functions/src/utils.js:
Imported lodash.get for nested field extraction.
Refactored typesenseDocumentFromSnapshot function to use lodash.get for accessing nested fields.
Updated field extraction logic to support dot notation for nested fields.
Test Updates:
In test/utils.spec.js:
Added new test suite "Nested fields extraction" with four new test cases:
This change improves the flexibility of our Firestore to Typesense synchronization extension. Users can now easily map nested Firestore fields to Typesense, allowing for more complex data structures to be indexed and searched efficiently. This feature is particularly useful for projects with deeply nested document structures, enabling fine-grained control over which specific nested fields are synchronized to Typesense.
What is this?
This pull request enhances our Firestore to Typesense synchronization by adding support for nested field extraction. It allows users to specify nested fields using dot notation, making it easier to sync complex data structures from Firestore to Typesense.
Rationale
This change resolves issue #90, which requests dot notation support for the "Firestore Collection Fields" parameter. By implementing this feature, we enable users to access any level property on fields they want to explicitly include in the trigger.
Changes
Added Features:
functions/package.json
:lodash.get
(version 4.4.2) for safe nested property access.Code Changes:
functions/src/utils.js
:lodash.get
for nested field extraction.typesenseDocumentFromSnapshot
function to uselodash.get
for accessing nested fields.Test Updates:
test/utils.spec.js
:Context
This change improves the flexibility of our Firestore to Typesense synchronization extension. Users can now easily map nested Firestore fields to Typesense, allowing for more complex data structures to be indexed and searched efficiently. This feature is particularly useful for projects with deeply nested document structures, enabling fine-grained control over which specific nested fields are synchronized to Typesense.
PR Checklist