Configure your browser so that it uses the JMeter proxy, set:
MongoDB Source Config configures the connection to MongoDB for you and stores in MongoDB Source the configuration.
You can then access it in any Scripting element using:
com.mongodb.DB db = org.apache.jmeter.protocol.mongodb.config.MongoDBHolder.getDBFromSource("db", "test");
In order to run the login sample inside plan, create a CSV file following description in loginData sample and put it in a folder of your choice then test running JMeter with: