Book Image

SoapUI Cookbook

By : Rupert Anderson
Book Image

SoapUI Cookbook

By: Rupert Anderson

Overview of this book

Table of Contents (19 chapters)
SoapUI Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Querying MongoDB with Groovy


The simplicity and scalability of document-based or NoSQL databases has made them very popular. One of the most popular NoSQL databases is MongoDB (http://www.mongodb.org/). In this recipe, we learn how to query MongoDB by calling its API using a Groovy TestStep.

Tip

MongoDB as a service backend

Since MongoDB stores data as documents using the (Binary JSON) or BSON format, it can be convenient for use as a service or a mock backend when JSON data is required.

Getting ready

If you don't already have MongoDB, then install it using the instructions on the main MongoDB site (http://docs.mongodb.org/manual/installation/). I am assuming that MongoDb will be running on the usual localhost and port 27017. By default, no authentication is required; this will be assumed in this recipe.

To access MongoDB from Groovy, you can use the MongoDB Java driver. However, Groovy users have the option of GMongo, which simplifies the API nicely.

Note

GMongo

This is a convenient Groovy wrapper...