MongoDB-specific query builder for FHIR resources, built on top of fhir-query-store.
@healthcare-interoperability/fhir-query-mongo-store
provides MongoDB-compatible query generation utilities for storing and updating FHIR resources using bulk operations. It extends the generic FHIR query framework provided by @healthcare-interoperability/fhir-query-store
, enabling support for real-world healthcare integration workflows and storage patterns.
- 🔁 Supports FHIR Bundles (type
collection
,transaction
, etc.) - ⚙️ Converts FHIR resources into
bulkWrite
-ready MongoDB update queries - 🧠 Optimized for idempotent operations using
updateOne
withupsert
- 📦 Handles integration IDs and task-based processing
- 🧩 Built for composability and subclassing
npm install @healthcare-interoperability/fhir-query-mongo-store
import { FHIRMongoBundleProcessor } from '@healthcare-interoperability/fhir-query-mongo-store';
const bundle = {
resourceType: 'Bundle',
type: 'collection',
entry: [/* array of FHIR resources */]
};
const processor = new FHIRMongoBundleProcessor(bundle)
.setIntegrationId('your-integration-id');
const queries = processor.query();
// `queries` is an object keyed by resource type, each with an array of MongoDB operations
// e.g. { Patient: [ { updateOne: { filter, update, upsert: true } } ] }
Processes a FHIR bundle and generates MongoDB-compatible update queries.
new FHIRMongoBundleProcessor(bundle)
-
bundle
: A valid FHIR Bundle or single resource.
Sets an integration ID to associate with all processed queries.
Returns an object where each key is a FHIR resource type (e.g., "Patient"
) and the value is an array of MongoDB update queries ready for bulkWrite
.
-
@healthcare-interoperability/fhir-query-store
: Generic FHIR query generation framework used as the base for MongoDB and other data stores.
MIT