Throws error when “new CouchDB.Database(queueDb);” for the second time


#1

I am using meteor-couchdb and trying to connect to db when an API call is made and perform the required operation.

dbName = new CouchDB.Database('db_name');

But when API call is made again it throws below error

Error: A method named '/db_name/insert' is already defined

Depending on the API call, I should be able to select the Db it need to be connected. I tried doing in node way i.e

Cloudant.use('db_name');

But then as Meteor is my server side framework I need to handle async function in synchronously using async await.

What would be the suggested approach to connect to db and perform the actions, whenever an API call is made ?