Amit
Amit

Reputation: 283

How can I print my MongoDB queries from loopback

I want to print all the queries executed on MongoDB from my loopback 3 application when in debug mode. I tried setting "DEBUG" : "loopback:connector:mongodb"

Upvotes: 1

Views: 792

Answers (1)

Abhishek Badoni
Abhishek Badoni

Reputation: 36

I am using Loopback 2 and I also had to check the MongoDB queries for my APIs. I just used DEBUG=loopback:connector:mongodb node . command to start my loopback server with debugging enabled.

There is one more alternative way to do this. You can add a key debug and set it true in your datasource config file datasource.json files. If the above two methods don't work for you, Please check the values of debug property in MongoDB function in node_modules/loopback-connector-mongodb/lib/mongodb.js file.

Resources https://loopback.io/doc/en/lb2/Setting-debug-strings.html

Upvotes: 2

Related Questions