Questions tagged [jongo]

Jongo allows to query in Java as in Mongo shell; unmarshalling results into Java objects (by default with Jackson).

Jongo

Using Mongo with its Java driver can be tricky: querying, mapping results and handling polymorphism require lots of code. Some libraries aim to simplify this (like Morphia), but none allow to query in a shell fashion.

Jongo tries to fill that need, querying with the use of strings "{age: {$gt: 18}}" and unmarshalling results into Java objects (by default with Jackson):

DB db = new Mongo().getDB("dbname");

Jongo jongo = new Jongo(db);
MongoCollection friends = jongo.getCollection("friends");

friends.find("{age: {$gt: 18}}").as(Friend.class)
111 questions
1
vote
1 answer

Custom aggregation with WSO2EI and MongoDB

I'm tring to implement aggregation operations for Mongo data service in WSO2DSS (in WSO2EI) since only the basic operations like CRUD and Count are supported out of the box as mentioned here. So I cloned WSO2EI code version 4.4.10 (our team happens…
vod0029
  • 45
  • 4
1
vote
1 answer

Query Date in Jongo

I want to use Jongo for date queries. The user should be able to enter a string with the query, so I want to use the find method with a string. I am using groovy. My code: jongo.getCollection("mycollection").find("{birthday: {\$lt :…
Peter
  • 1,011
  • 2
  • 16
  • 39
1
vote
1 answer

Collation with jongo

I use MongoDB via Jongo (a Java client), and I need to sort results in a case-insensitive way for a particular query. MongoDB's documentation states that an index should be created with a certain collation level, and that the queries should use the…
Olivier Croisier
  • 6,139
  • 25
  • 34
1
vote
1 answer

Jongo connect to remote MongoDB server

Is it possible to connect to a remote MongoDB when using Jongo (jongo.org)? I saw a piece of code where MongoClientURI was used like this: MongoClientURI uri = new MongoClientURI("mongodb://IP_ADDRESS:27017/DB_NAME"); I have the following…
Jules
  • 546
  • 2
  • 11
  • 36
1
vote
1 answer

How to do upsert using jongo?

I have a users table/collection and would like to upsert a user - update a user if exists or add a new one if still not exists. Structure below. By "exists", I mean having some external ID. In this case, googleId. How can I do it using Jongo…
AlikElzin-kilaka
  • 34,335
  • 35
  • 194
  • 277
1
vote
0 answers

How can I remove the mongodb.cluster message?

I am developing a JSF application with MongoDB connection with Jongo but the console is showing the next message and I would like remove its: Grave: 9 [http-listener-1(4)] INFO org.mongodb.driver.cluster - Cluster created with settings…
Juan Camacho
  • 736
  • 2
  • 7
  • 15
1
vote
1 answer

How can I remove the MongoDB message of Java console?

I have MongoDB 3.2.9 and I am developing an Java application with Jongo 1.3.0 but the NetBeans console is showing the next red message: nov 24, 2016 2:30:17 AM com.mongodb.diagnostics.logging.JULLogger log INFORMACIÓN: Cluster created with settings…
Juan Camacho
  • 736
  • 2
  • 7
  • 15
1
vote
1 answer

Eclipse plugin runtime creation Issue - java.lang.NoClassDefFoundError

I am getting Eclipse plugin: java.lang.NoClassDefFoundError for org/jongo/ResultHandler My source code compiled successfully after adding the necessary jar files.I have added these jars using project>build path as Reference libraries in Eclipse. Now…
Ronak
  • 281
  • 1
  • 4
  • 17
1
vote
0 answers

Retrieve objects inside property id using $group

Given the following collection: {"city" : { "name" : "BLUMENAU", "state" : { "country" : { "latitude" : 0.0, "longitude" : 0.0 }, "latitude" : -27.2423392, …
1
vote
1 answer

In Kotlin, why Jackson fails unmarshalling non-annotated object in some cases and not in others

I'm using Kotlin with Jongo to access MongoDB. Jongo uses Jackson to serialize/deserialize objects in order to save and read them from MongoDB. I use Jackson-Kotlin module to help serialize Kotlin data classes using constructors. Here's an example…
Krešimir Nesek
  • 5,302
  • 4
  • 29
  • 56
1
vote
1 answer

MongoDB - Jongo - maximum value of a field with aggregation

I have this type of document into my collection. I store many components which have a version. { "_id" : "compagny/component_name/2.3.3", "type" : "action", "owner" : "compagny", "name" : "component_name", "version" : "2.3.3", …
ascott
  • 552
  • 1
  • 5
  • 16
1
vote
2 answers

Saving a POJO in MongoDB with null fields using Jongo

so I have a POJO object that I am creating and saving to a MongoDB collection using Jongo: import java.util.Map; public class MyObject { private String name; private Map mappings; public MyObject() { } public…
Garlando
  • 196
  • 7
1
vote
2 answers

Jongo MongoCollection.insert(String query) is parsing # as a param. How to avoid it

I am invoking the mongoCollection.insert(String query) method of jongo, inorder to insert a JSON into the collection. The JSON contains a # character in the field value. But since # is used as a query param token indicator, I will end up getting an…
DPL
  • 21
  • 3
1
vote
1 answer

How to send a mongodb shell function on jongo insert functions

I'm trying to use a MongoDB shell function, like Date(), on a Jongo driver function to generate a value for my fiedd. The code is the following: collection.insert( "{ date: Date() }" ); But it doesn't seem to work, any advice ? Those are the errors…
Guerino Rodella
  • 321
  • 4
  • 16
1
vote
2 answers

No data in Mongo DB in Play framework when running in Test mode

I have play framework application v2.2 that use Mongo Database (using play-jongo). I have some testing unit class in /test folder. However if I run the unit class using test command or run directly from eclipse, there is no data found at all from…
null
  • 8,669
  • 16
  • 68
  • 98