How can I trace mongoDB queries

9,678 views
Skip to first unread message

lexer

unread,
Aug 5, 2010, 12:45:39 AM8/5/10
to mongodb-user
Hi guys,

I'm running mongodb server as a windows service. How can i connect to
it via console to trace executed queries?

Best regards,
Alexey Zakharov

Eliot Horowitz

unread,
Aug 5, 2010, 12:48:25 AM8/5/10
to mongod...@googlegroups.com
See http://www.mongodb.org/display/DOCS/Database+Profiler

> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>
>

lexer

unread,
Aug 5, 2010, 1:07:00 AM8/5/10
to mongodb-user
May be I haven't say correctly what I need. I don't want to profile
queries, I just want to see what queries have been generated. I can do
it know now using mongod -vv, but don't know how to do the same with
running as windows service mongo server.

On Aug 5, 10:48 am, Eliot Horowitz <eliothorow...@gmail.com> wrote:
> Seehttp://www.mongodb.org/display/DOCS/Database+Profiler

Eliot Horowitz

unread,
Aug 5, 2010, 1:15:17 AM8/5/10
to mongod...@googlegroups.com
If you turn on the query profiler and set the threshold to 0, all
queries will be logged so it'll essentially be a trace

lexer

unread,
Aug 5, 2010, 1:39:12 AM8/5/10
to mongodb-user
Okey. Thank you. I will try it.

On Aug 5, 11:15 am, Eliot Horowitz <eliothorow...@gmail.com> wrote:
> If you turn on the query profiler and set the threshold to 0, all
> queries will be logged so it'll essentially be a trace
>

Arthur Neves

unread,
Feb 22, 2013, 5:47:22 PM2/22/13
to mongod...@googlegroups.com
If you set:

db.setProfilingLevel(0,20)

It wont save profile data no the system.profile collection, however it will log(in file) everything slower than 20ms.

On Friday, February 22, 2013 1:41:36 PM UTC-5, Adam Baldwin wrote:
That does nothing --if I use db.system.profile.find() with level 0, no results are returned

Moacy Barros

unread,
Mar 28, 2013, 11:20:59 PM3/28/13
to mongod...@googlegroups.com
Hello Alexey,

as Arthur told us, you can use Profiling, more details here: http://docs.mongodb.org/manual/tutorial/manage-the-database-profiler/


Regards,
Moacy

João Martins

unread,
Mar 30, 2013, 10:09:25 PM3/30/13
to mongod...@googlegroups.com

You can use mongosniff mongosniff provides a low-level operation tracing/sniffing view into database activity in real time.


regards
joao
Reply all
Reply to author
Forward
0 new messages