Search code examples
mongodbmirthhl7-fhir

Write data into mogoDB using mirth connect


I am using mirth connect to for fhir data, i am able to separate the data into separate variables but don't know how to store into mongoDB as database writer doesn't have any mongoDB option. Thanks in advance.


Solution

  • In this case you can use the DB connection through Javascript, try using the below script this is a basic connectivity.

    var mongoClient = new Packages.com.mongodb.MongoClient("localhost", 27017);
    var database = mongoClient.getDatabase("mongoDB");
    var collection = database.getCollection("testDB");
    

    By default, mongoDB listens in the port 27017. And If you are parsing FHIR then you may need to store entire resource as JSON.

    you can append the values in the JSON data using .append function and insert them into your db. I hope this code helps.