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
0
votes
1 answer

MarshallingException: Unable to unmarshall result Reference

I am using play 2.4 and would like to set an reference object "document" in model "user". If I iterate over iterator, I get the following error: So if I call the route /users, where normally I should get an Json list with all user objects and…
abuder
  • 1,030
  • 2
  • 13
  • 31
0
votes
1 answer

Mongo find query with specific filter

With this dataset, I’m trying to do a query which return for all the document, the rank of the articles relevant. But I don’t know if it is possible with only a mongo query. content_business : { id : {….} , content : { uid : « 01234 », FL :…
Blured Derulb
  • 201
  • 3
  • 12
0
votes
0 answers

creating function/procedure inside mongodb to read contents of file stored in side mongodb

Please help in below situation. I have a text/doc/htm file which needs to be stored in mongodb using java application.(this part I have did using GridFS) After storing file, I want to retrieve the contents of file using a function/procedure inside…
user3742631
  • 123
  • 1
  • 5
0
votes
0 answers

How to GET last dates within a certain constraint

I am trying to figure out how I can pull records from a mongo database using Jongo that will check the date that is on the object in the db and will only return an object with the data from, in my case, the last three most current dates. I'm using…
Kristaphonie
  • 99
  • 2
  • 11
0
votes
0 answers

Getting generic return from Jongo finds

I have a collection structure mapped on a Java class ( just like jongo does ). One of those objects is a generic class ( T ). To insert data on the collection I used the annotation JsonProperty( "property_name" ) and it works pretty charm. The…
Guerino Rodella
  • 321
  • 4
  • 16
0
votes
1 answer

Jongo Maven dependency causing run time issue

I have a Maven project where I am using the Jongo dependency with the following POM.
user1965449
  • 2,849
  • 6
  • 34
  • 51
0
votes
2 answers

How do I get a specific element of the array in mongoDB?

I want to get a specific element of the array and through the responsaveis.$ (daniela.morais@sofist.com.br) but there is no result, there is problem in my syntax? { "_id" : ObjectId("54fa059ce4b01b3e086c83e9"), "agencia" : "Abc", …
Daniela Morais
  • 2,125
  • 7
  • 28
  • 49
0
votes
1 answer

Update an array using Jongo

I have a mongodb collection of the form { "_id":"id", "userEmail":"userEmailFromCustomerCollection", "customerFavs":[ "www.xyz.com", "www.xyz.com", "www.xyz.com" ] } I need to add an element to the customers favs array using…
user1965449
  • 2,849
  • 6
  • 34
  • 51
0
votes
1 answer

How can I save this JSON in mongoDB?

I need save this JSON: {edbff2886c8ca7aa1bd02b092aa03930.zip=T001.zip}. It's from a Map. Why isn't possible? com.mongodb.WriteConcernException: { "serverUsed" : "127.0.0.1:27017" , "ok" : 1 , "n" : 0 , "updatedExisting" : false ,…
Daniela Morais
  • 2,125
  • 7
  • 28
  • 49
0
votes
0 answers

Errors writing to MongoDB Primary/Master replica set member from Java using Mongo driver

I am having an issue with migrating an application to a more distributed architecture. Specifically, I recently began migrating an application into a MongoDB replicaSet where all members communicate using a local subnet inside a virtual cloud. The…
Brandon K
  • 751
  • 1
  • 4
  • 12
0
votes
1 answer

using $group Aggregation in Jongo

I am using Jongo to query my MongoDB with Java. My question is "How can I save a sum into a Class attribute?" I have a Class OffersByPostalCode public class OffersByPostalCode { private String _id; private String offers; public…
Alaa-GI
  • 410
  • 1
  • 5
  • 19
0
votes
1 answer

Jongo MongoDB: How to specify a default ReadPreference

I am aware that I can set the readPreference for each query using .withReadPreference(primaryPreferred()).find(...). However, I would prefer to set a global default readPreference to use "nearest" if possible, and then be able to…
Brandon K
  • 751
  • 1
  • 4
  • 12
0
votes
1 answer

Java server stopped working

I have Java server, but I know really a little about Java. I develop to company in HTML, CSS, JS and JS libraries, but from today I am unable to start server again. Each file has error, for example, first one on the 5 line, where is that code …
Patrik Krehák
  • 2,595
  • 8
  • 32
  • 62
0
votes
1 answer

Best java library for POJO mapping with MongoDB

I've bean using Morphia for some time (2+ years) now but not much has happens with the library to incorporate the new features in MongoDB 2.6+ version. Looking at the activity on Github, not much has happen since early semptember and I am start to…
Chris
  • 712
  • 3
  • 16
  • 39
0
votes
1 answer

Error with Jongo parsing JSON

I'm using a combination of Java Play Framework, MongoDB and Jongo as my go between for a basic web CRUD app. I keep receiving a JSON parse exception even though my string doesn't contain any illegal characters. It's actually failing on closing curly…
marcus
  • 141
  • 2
  • 10