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

Jongo and Jersey

My query returns Iterable elements and now I want to return it to the user in JSON format but Jersey can not convert it. it says: A message body writer for Java class org.jongo.MongoIterator, and Java type java.lang.Iterable, and MIME media type…
Abzal Kalimbetov
  • 505
  • 7
  • 20
0
votes
1 answer

MongoDB aggregation cannot use $limit twice

I have the following MongoDB collection "Games": { "_id" : ObjectId("515461d3c6c18efd4a811fd3"), "gameid" : NumberLong("86982207656"), "tableName" : "Hydra Zoom 40-100 bb", "nplayers" : 6, "playersList" : [ …
nuvio
  • 2,555
  • 4
  • 32
  • 58
0
votes
1 answer

$avg not returning average

this is my code: //Build the query //match only records in cluster 1 DBObject match = new BasicDBObject("$match", new BasicDBObject("clusterId",_id)); //the projected result must be : clusterId, squeezePlay, weakShowdown,…
nuvio
  • 2,555
  • 4
  • 32
  • 58
0
votes
1 answer

Play-jongo unresolved dependency

I'm trying to use Play-jongo https://github.com/alexanderjarvis/play-jongo with Play 2.0. The Build.scala looks like this. val appDependencies = Seq( "uk.co.panaxiom" %% "play-jongo" % "0.2" ) val main = PlayProject(appName, appVersion,…
stevew
  • 674
  • 10
  • 19
-1
votes
1 answer

Mapping JSON to Class not working

I have a class which contains other some properties of another classes and when I try to convert from json to my class, there is an error displayed. This is my class: import org.jongo.marshall.jackson.oid.MongoObjectId; import…
V. Sambor
  • 12,361
  • 6
  • 46
  • 65
-1
votes
1 answer

Check if Object (document) exists in MongoDB (using Jongo)

I'm trying to find out if an Object (document) exists in a collection. Here's what I've tried but I'm stuck. @DbTable(name = "websites") private MongoCollection websitesTable; private boolean isInTable(String url) { FindOne p =…
user1924244
  • 135
  • 9
1 2 3 4 5 6 7
8