Complete shell-line as string as query

16 views
Skip to first unread message

Tilman Adler

unread,
May 12, 2016, 10:42:44 AM5/12/16
to Jongo
Is there any way to user jongo as some kind of reimplementation of the mongo shell in java? I.e. can I use a string like db.getCollection('foobar').find({}) to query in jongo?

Thanks!

Benoît GUEROUT

unread,
May 12, 2016, 3:27:23 PM5/12/16
to Jongo
Sure.
You can find examples on http://jongo.org

collection.save(new Friend("John", "22 Wall Street Avenue"));
Friend friend = collection.findOne("{name:'John'}").as(Friend.class);

Tilman Adler

unread,
May 13, 2016, 9:53:58 AM5/13/16
to Jongo
Sorry, I was unclear. I need to use an actual String to query. Something like this:

Jongo jongo = new Jongo(mc.getDB("test"))
jongo.createQuery("db.getCollection('foobar').find({})").execute()

Benoît Guérout

unread,
May 25, 2016, 2:36:38 AM5/25/16
to jongo...@googlegroups.com

No sorry this is not possible.
createQuery allows you to create bson query {}

--
You received this message because you are subscribed to the Google Groups "Jongo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jongo-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages