Mongrel | MongoDB connect and close within trigger

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Mongrel | MongoDB connect and close within trigger

mountainbiker
calling Mongrel to add, update, and delete from the trigger.  Works great!  In your experience, is it possible to keep the connection open vs. doing a mongodb:connect/mongodb:close per trigger action?
Reply | Threaded
Open this post in threaded view
|

Re: Mongrel | MongoDB connect and close within trigger

Dannes Wessels-3
Hi,

On 1 Dec 2016, at 13:56 , mountainbiker <[hidden email]> wrote:

calling Mongrel to add, update, and delete from the trigger.  Works great! 

great to hear!

In your experience, is it possible to keep the connection open vs. doing a
mongodb:connect/mongodb:close per trigger action?

Sure, you can  re-use the mongoClientId  for a sequence of commands;

let $mongodbClientId := mongodb:connect($mongoUrl)

It is actually possible to -as long the database is running and the connection is not closed- use the token for all scripts for all users. Just  store the clientId/token in a document in the database , and read it from this document for each xquery script.

For sure you might need to think about some potential security risks, but there are no limitations.

cheers

Dannes

------------------------------------------------------------------------------

_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open