After setting the profiling to 1, I can't see the system.profile collection in the database

After setting the profiling to 1, I can’t see the system.profile collection in the database

use newDB
switched to db newDB
db.getProfilingLevel()
0
db.setProfilingLevel(1)
{ “was” : 0, “slowms” : 0, “sampleRate” : 1, “ok” : 1 }
show collections
Blank output
Any help - why it is happening?

Hi @PUNYABRATA_57182,

You can only see system.profile collection only by querying on it. All collections like system.profile or system.users are not shown when we do show collections. Here is how you can look at the collection.

 db.system.profile.find()

Kanika

But in the Profiling Database Lecture, it was shown

Hi @PUNYABRATA_57182,

The command show collections no longer lists the system.* collections. It changed after version 4.0.

To list all of the collection names you can run this command:

 db.runCommand({listCollections: 1})

Thanks for notifying the issue. We will soon update the lecture notes. :slight_smile:

Kanika

2 Likes