print mongo query so it can be pasted in mongo shell

86 views
Skip to first unread message

Matteo Moci

unread,
May 22, 2015, 9:58:34 AM5/22/15
to jongo...@googlegroups.com
Hi All,
I am just starting with Jongo, and to debug one query I'd like to print the exact query the objects are converted to, so I can paste it in the mongo shell and see how it goes.
Is there a simple way to do this?

Thanks,
Matteo

Vins

unread,
May 22, 2015, 12:57:43 PM5/22/15
to jongo...@googlegroups.com

I'm also looking for the same feature.

I have a big query in aggregation. I would like to print it.

Vins

Vins

unread,
May 22, 2015, 3:32:29 PM5/22/15
to jongo...@googlegroups.com

I have checked the Jongo code, right now there is no way to do this.  

One way you can do is using AOP.

create an aspect that will print the paramter that you are passing to a particular method in Jongo.

Thanks,
Vins

Benoît GUEROUT

unread,
May 22, 2015, 4:15:41 PM5/22/15
to jongo...@googlegroups.com, vcku...@gmail.com
Here is more informations : https://github.com/bguerout/jongo/issues/256

Does it fit your needs ?

Vins

unread,
May 23, 2015, 11:48:22 PM5/23/15
to jongo...@googlegroups.com, vcku...@gmail.com

I have a huge query that we use in our project. When we went with Mongo driver option, we had 100+ lines of code. Which got reduced drastically when we switched to Jongo. Above all we are saving the time in conversion of the query and associated bugs.

 I would like to print the query that I'm passing to  Aggregate ,  I think if we add a tiString() method into the Aggregate class to print the pipeline and options that will solve the issue.

Thanks,
Vins
Reply all
Reply to author
Forward
0 new messages