我想使用mirth connect连接mongodb.任何人都可以为我提供一个示例频道吗? 而且任何人都有任何统计数据,在一分钟内我们可以使用mirth connect处理多少条消息.
I want to connect mongodb using mirth connect. can any one provide me a sample channel for the same. also any one have any statistics that in a minute how many message we can process using mirth connect.
推荐答案我创建了一个示例,用于用Mirth测试MongoDB.
This an example I created myself to test MongoDB with Mirth.
在源连接器上,根据MongoDB Java驱动程序网页此处:
On the source connector, choose the type as Javascript and copy the following code, based on the example available at the MongoDB Java Driver webpage here:
var mongoClient = new Packages.mongodb.MongoClient("localhost", 27017); var database = mongoClient.getDatabase("mydb"); var collection = database.getCollection("test"); /* var doc = new Packages.bson.Document("name", "MongoDB") .append("type", "database") .append("count", 1) .append("info", new Packages.bson.Document("x", 203).append("y", 102)); */ var jsonDoc = JSON.stringify({ "name" : "MongoDB", "type" : "database", "count" : 1.0, "info" : { "x" : 203.0, "y" : 102.0 } }); var doc = Packages.bson.Document.parse(jsonDoc); // drop all the data in it collection.drop(); collection.insertOne(doc); // get it (since it's the only one in there since we dropped the rest earlier on) var myDoc = collection.find().first(); logger.debug(myDoc.toJson()); mongoClient.close(); return;注释后的代码使用Java创建了一个BSON文档,而另一个代码则将JSON解析为BSON,这通常发生在Mirth中,例如,如果接收到JSON中的FHIR资源.
The commented code creates a BSON document using Java, while the other parses a JSON to BSON, as it would normally happen in Mirth if receiving, for instance, a FHIR resource in JSON.
一件重要的事情:您必须将以下jar从其存储库复制到custom-lib 此处
One important thing to do: you have to copy the following jars to custom-lib from their repository here
- bson
- mongodb驱动程序
- mongodb-driver-core
更多推荐
Mirth连接到Mongo DB连接
发布评论