Retreiving data from Mongo db using Groovy and assigning it to a test case property
Hi, I'm looking to create a test step that can connect to MongoDB, run a query, and then assign the result to a test case property. I have the connection working and I can retrieve a result as a row count. However I cannot get the actual result to assign it to a test case property. I know how to assign a value to a test case property but simply cannot get the result in order to do that. Below is my existing code. I'm connecting to a MongoDB called database called 'digital', within that there is a collection called 'QuoteSummary'. Within 'QuoteSummary' I'm searching for a "quoteRefNo" where "workReferenceNo" = GPE0024879. Its the resulting "quoteRefNo" that I want to assign to a test case property.
Re: Retreiving data from Mongo db using Groovy and assigning it to a test case property
I used the below code you have mentioned
If I used first() or last() function it works fine. I pull the first or last document from the collection. However if I try to use just find() I’m not able to retrieve ALL the documents that match the query I pass in the file. Can you please help? What is the code to pull all the docs from the collection.