How to display sql execution time for cursor-like stage

i want to display sql execution time on shell?

who can help me ?

We do not understand what you want. MongoDB is not SQL. What information do you want exactly?

i want to display time like this

i upload it,please help me,tks

I think the exact output they show is from an old shell. The best way to obtain data about a query is with

If I remember correctly, it is covered in M201.

1 Like

Also,

  1. StackOverflow Hacker Post, and the repo Hacker GitHub
    or
var b = new Date()
#query here
print(new Date() - b + " ms")

Or if you only want to compare queries, this is after you read cursor.explain(): Analyze Query Performance.

In the current MongoDB output, good params are Total docs & keys examined (if remember correctly).


PS: bear in mind that this plugin, as far as I understand, loads itself using the mongorc file, so you have to remove --norc from the original command for m121.

If it loads, you’ll see:

MongoDB server version: 4.2.11
Mongo-Hacker 0.1.1

And this output:

It also tweaks the prompt (I didn’t like it). You can probably change this in the rc file. Looks like a very nice plugin though.

2 Likes

Hi @jing_xu,

We have a great community forum where you can have an in-depth conversation about specific use cases and interesting problems that you get to solve using MongoDB. I would highly recommend posting your question there for a more involved discussion.

Thanks @steevej-1495, @Santiago_Miranda for your support to the community. :clap:

Kind Regards,
Sonali