ReadyAPI + CosmosDB connection
I am trying to connect to Cosmos DB using the connection string but I am unable to connect to the collection available in the DB. Please find the script below. Please suggest how can I connect and read the data from the Cosmos DB collection.
def mongo = new GMongo('Sample Connection string');
def db = mongo.getDB('prs');
BasicDBObject query = new BasicDBObject("policy_number","12345")
def collection = db.getCollection('cccVacPolicy')
log.info("connect with PRS DB")
def myDoc = collection.findAll();
I think i have a CosmosDB ReadyAPI project saved somewhere. I'll try and dig it out, it might help.
digging through my old hard drive now for it,
I found it - this isn't one of my projects - I think I found this on the web somewhere and saved it cos I thought - "I might have to test a CosmosDB endpoint one day"
I'm attaching the whole project - you'll have to edit the custom project level properties for your instance - but I think this will allow you to connect. the first testcase appears to have all the different REST requests to call all the different info you'd want - a Collection, All Collections, documents, etc.
Have a look and see if it helps,