Questions tagged [mongo-jackson-mapper]

42 questions
1
vote
1 answer

Execute mongoDB shell like query using a java class

Using a java class i want to execute MongoDB shell query stored in a String variable.Currently i am using the following code. String query="db.INSTANT.insert( { item: 'card', qty: 12 } )"; MongoClient mongo = new MongoClient("localhost",27017); DB…
Nandu
  • 151
  • 1
  • 2
  • 12
1
vote
0 answers

MongoJack MongoDB Scala Optional ObjectId Not Working

Hi I have my case class defined as so case class bread ( @ObjectId @JsonProperty("_id") id: Option[String] = None, @JsonProperty("yeast_level") yeastLevel: Int, @JsonProperty("name") name: String ) My Json looks like this { "id":…
1
vote
1 answer

How to use elemmatch in in mongojack in Java

Given a mongoDB collection containing the following: { "_id" : ObjectId("561c04bde4b05625eaaaf691"), "groupName" : "Group1", "Rights" : [ "RIGHTS_1", "RIGHTS_2" ], "users" : [ "User 1" ]} ,{ "_id" :…
Harry
  • 111
  • 1
  • 8
1
vote
0 answers

How to define a json object type in a JacksonDB Mapper for MongoDB?

I am building a Play framework Java application with mongodb as the backend. I am using Jackson DB Mapper to define the model. One of the models needs to have a field called "filter" with the following value in the Mongodb, "filters" : { …
Rohit Rane
  • 2,790
  • 6
  • 25
  • 41
1
vote
1 answer

Mongojack- how to create composite Primary key

We are using mongodb & MongoJack for mapping our collections. There is a need where we need to create composite primary key. We are not getting correct configuration how to use @Id annotation. Can anyone help in this or should we avoid using…
Raichu
  • 117
  • 1
  • 11
1
vote
0 answers

How to map id to _id when serializing/deserializing doc in MongoDB using Jackson?

I am looking for a way to map _id to id of the doc which I serialize or desrialize from Mongo DB. I am using Jackson for my project. Here is what my id fields looks like. @Valid @ObjectId //not sure what to write here; @JsonProperty(value="_id")…
matuda
  • 195
  • 2
  • 16
1
vote
2 answers

javax.persistence.Transient (@Transient) is not working with MongoDB while updating

I am trying to use @Transient (javax.persistence.Transient) in one of my entity, it works fine for inserting the records (the Transient fields are not stored in DB which is OK) but when I am trying to update the same entity the Transient fields…
1
vote
0 answers

Save form data to multi-value field on MongoDB using Play2.2.2

I'm experimenting with play (v2.2.2), and I have it connected to MongoDB (v2.4.6) using jackson. I have a models.Role class with the following attributes: @Id @ObjectId public String id; public String name; public ArrayList permissions; On…
1
vote
2 answers

Ignore field with annotation for JSON serialization but not for Mongo in MongoJack

Is there any possibility to ignore field for JSON serialization (for web display) but not for mongo (internal serialization) ? I`ve tried so far all these methods but field was also ignored for Mongo, or not ignored in both in case of some…
0
votes
2 answers

How to deserialize this dynamic keys JSON to Java custom Pojo using Jackson

I have a pretty complex json string that I would like to deserialize into custom Java Pojo, but Im not so sure how to do it. Here is the json: { "A": { "view": { "1": ["stringA", "stringB"], "2":…
Shvalb
  • 1,835
  • 2
  • 30
  • 60
0
votes
3 answers

Unable Parse a JSON using Jackson

I have a mongo database call in my code. The response from the database is mapped using codehaus jackson. Json: [ { "_id": "555", "rates": 1, "reviews": [ { "author_name": "Instructor 9999", "_authKey":…
Sumit
  • 856
  • 5
  • 18
  • 38
0
votes
1 answer

How to append new value to a list in mongodb?

I want to insert a new element the "CarList" array below. I am using MongoDB and dropwizzard in my project. { "_id": "56aa6119bf78f37eee64697e", "name": "Jack", "occupation": "business*emphasized text* owner", "carList": [{ …
matuda
  • 195
  • 2
  • 16
0
votes
1 answer

Java - MongoDB - Map Json object as Java Array

I've got an XML configuration mapped to a JSON document which has an array of elements, but when there is only one element, the document looks like this: { "name" : "test2" "products" : { "id" : "prod3" "value" :…
peter_f
  • 258
  • 1
  • 2
  • 11
0
votes
1 answer

What is the JacksonDB equivalent of db.collection.find({},{"fieldName":1})?

I am new to Jackson DB. Now I know that to get the entire document list of a collection using Jackson we need to do : COllectionClass.coll.find().toArray(); which is Jackson DB equivalent to the mongodb command : db.collection.find() So What is…
Rohit Rane
  • 2,790
  • 6
  • 25
  • 41
0
votes
2 answers

What package do I need to import for the Jackson mongodb DBquery functions to compile in Java?

I have this query string : coll.find(and(DBQuery.greaterThanEquals("createdOn", startDate), DBQuery.lessThanEquals("createdOn", endDate),DBQuery.is("user_email",userEmail))); I am getting the error : cannot find symbol [symbol: variable DBQuery]…
Rohit Rane
  • 2,790
  • 6
  • 25
  • 41