No blank lines is allowed in the MongoDB Script Sampler. If there is a blank line after MongoDB statement, the statement will still be executed but the word “ok” will be displayed in the response.
Add new document into the collection
Step 1
Change the “Script” area of the MongoDB Script sampler with insert query. In this case, the query of adding document into the collection is shown as follows: db.getCollection('zips').insert({"city" : "BABYLON", "loc" : [ 32.211100, 44.251500 ], "pop" : 300000, "state" : "IS" })
Step 2
Run the updated script in JMeter. The request details will be shown in the “Request” tab of the “View Results Tree Listener”. The results will be shown in the “Response data” tab.
Step 3
Change the MongoDB Script