MongoDB Enterprise > db.getProfilingLevel()
1
MongoDB Enterprise > db.system.profile.find().limit(1).pretty()
I dont see anything in the profile.
MongoDB Enterprise > db.getProfilingLevel()
1
MongoDB Enterprise > db.system.profile.find().limit(1).pretty()
I dont see anything in the profile.
Please check this link
This course is still on 3.4.2.
My question is I did not see anything in the profile, no index created
MongoDB shell version v3.4.2
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.2
Server has startup warnings:
2020-06-03T20:43:32.037+0000 I STORAGE [initandlisten]
2020-06-03T20:43:32.037+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2020-06-03T20:43:32.037+0000 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2020-06-03T20:43:32.067+0000 I CONTROL [initandlisten]
2020-06-03T20:43:32.067+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2020-06-03T20:43:32.067+0000 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2020-06-03T20:43:32.067+0000 I CONTROL [initandlisten]
MongoDB Enterprise > db.getProfilingLevel()
1
MongoDB Enterprise > db.system.profile.find().limit(1).pretty()
MongoDB Enterprise > db.runCommand({listCollections: 1})
{
“cursor” : {
“id” : NumberLong(0),
“ns” : “test.$cmd.listCollections”,
“firstBatch” : [
{
“name” : “system.profile”,
“type” : “collection”,
“options” : {
“capped” : true,
“size” : 1048576
},
“info” : {
“readOnly” : false
}
}
]
},
“ok” : 1
}
MongoDB Enterprise >
Only 1 collection created by
mongoimport -d m312 -c profiler_data /dataset/profile.json
There is no employees collections
Saw the profiler info on last lab replica set of m312RS
But it did not capture the index creation
MongoDB Enterprise m312RS:PRIMARY> db.system.profile.find({},{op:1, ts:1})
{ “op” : “getmore”, “ts” : ISODate(“2020-06-07T12:58:50.882Z”) }
{ “op” : “getmore”, “ts” : ISODate(“2020-06-07T12:58:51.211Z”) }
{ “op” : “getmore”, “ts” : ISODate(“2020-06-07T12:58:51.283Z”) }
{ “op” : “getmore”, “ts” : ISODate(“2020-06-07T12:58:51.317Z”) }
{ “op” : “getmore”, “ts” : ISODate(“2020-06-07T12:58:51.435Z”) }
{ “op” : “getmore”, “ts” : ISODate(“2020-06-07T12:58:51.521Z”) }
{ “op” : “getmore”, “ts” : ISODate(“2020-06-07T12:58:51.612Z”) }
{ “op” : “getmore”, “ts” : ISODate(“2020-06-07T12:58:51.699Z”) }
{ “op” : “getmore”, “ts” : ISODate(“2020-06-07T12:58:51.791Z”) }
{ “op” : “getmore”, “ts” : ISODate(“2020-06-07T12:58:51.874Z”) }
Did you try Level 2?
Level 1 - collects profiling data for slow operations only
Could not catch the indexCreate for some reason. I tried ms to 2, not work, still show 4.
MongoDB Enterprise m312RS:PRIMARY> db.setProfilingLevel(2, { slowms: 2 })
{ “was” : 2, “slowms” : 4, “ok” : 1 }
MongoDB Enterprise m312RS:PRIMARY> db.getProfilingStatus()
{ “was” : 2, “slowms” : 4 }
db.system.profile.find({op : { $nin: [“query”, “update”, “getmore”]}}, {op:1, ts:1,command:1}).pretty()
{
“op” : “command”,
“command” : {
“count” : “system.profile”,
“query” : {
“op” : {
“$in” : [
“query”,
“update”,
“getmore”
]
}
},
“fields” : {
“op” : 1,
“ts” : 1
}
},
“ts” : ISODate(“2020-06-07T21:14:06.987Z”)
}
{
“op” : “command”,
“command” : {
“count” : “employees”
},
“ts” : ISODate(“2020-06-07T21:42:19.057Z”)
}
{
“op” : “command”,
“command” : {
“dropIndexes” : “employees”,
“index” : “"
},
“ts” : ISODate(“2020-06-07T21:42:19.067Z”)
}
{
“op” : “command”,
“command” : {
“count” : “employees”
},
“ts” : ISODate(“2020-06-07T21:42:55.136Z”)
}
{
“op” : “command”,
“command” : {
“dropIndexes” : “employees”,
“index” : "”
},
“ts” : ISODate(“2020-06-07T21:42:55.139Z”)
}
I manually created the index, still not showing in profile.
But only in log.
2020-06-09T00:40:44.911+0000 I INDEX [conn1393] build index on: m312.employees properties: { v: 2, key: { last_name: 1.0, first_name: 1.0, employer: 1.0, email: 1.0, job: 1.0, quote: 1.0 }, name: “last_name_1_first_name_1_employer_1_email_1_job_1_quote_1”, ns: “m312.employees” }
2020-06-09T00:40:44.911+0000 I INDEX [conn1393] building index using bulk method; build may temporarily use up to 500 megabytes of RAM
2020-06-09T00:40:47.003+0000 I - [conn1393] Index Build: 623300/1010893 61%
2020-06-09T00:40:56.338+0000 I INDEX [conn1393] build index done. scanned 1010893 total records. 11 secs
Yes it is not captured
I tried it on test DB
Please check this open ticket
Certain commands are never captured in the system profiler, regardless of the value of the global profiling level
https://jira.mongodb.org/browse/SERVER-21855
Hi @anwei_78787,
You need to query the profiler_data and find the entry where the index was created.
Hint: Check the planSummary
field.
This will give you the index that was created. Then, check the ts
field to find when this change reflected on the behavior of our query.
Please feel free to reach out if you have any questions.
Thanks,
Sonali
Hi,
same as me, I can’t see anything in the profile.