Questions tagged [dbobject]

24 questions
18
votes
5 answers

Convert DBObject to a POJO using MongoDB Java Driver

MongoDB seems to return BSON/JSON objects. I thought that surely you'd be able to retrieve values as Strings, ints etc. which can then be saved as POJO. I have a DBObject (instantiated as a BasicDBObject) as a result of iterating over a list ...…
Ankur
  • 50,282
  • 110
  • 242
  • 312
8
votes
2 answers

Converting DBObject to Java Object while retrieve values from MongoDB

From my Java application, I have stored the values in mongoDB in ArrayList(set of Java objects). How can I retrieve the data from DBObject I am storing the data in mongoDB like this: { "students" : [{"firstName" : "Jesse", "lastName" : "Varnell",…
It's me
  • 1,065
  • 6
  • 15
  • 30
8
votes
3 answers

Insert DBObject into MongoDB using Spring Data

I tried to insert the following DBObject into MongoDB using Spring Data: BasicDBObject document = new BasicDBObject(); document.put("country", "us"); document.put("city", "NY"); mongoTemplate.insert(document); where mongoTemplate is…
Begoodpy
  • 1,018
  • 3
  • 8
  • 20
2
votes
1 answer

how to take a single record from an arraylist in mongodb

I am working with mongodb, and i have a pojo class named "Search" @Document(collection = "search_details") public class Search { @Id private String id; private String searchkey; private…
Jijesh Kumar
  • 299
  • 2
  • 13
1
vote
2 answers

MongoDB - Merging two DBObjects

I am writing a model factory, for which I use JSON to load up a MongoDB DBObject like this: import com.mongodb.util.JSON; DBObject dbObject = (DBObject) JSON.parse("{'name':'jack', 'age':30}"); Now, I am trying to break up my JSON files such that I…
jeffreyveon
  • 13,400
  • 18
  • 79
  • 129
1
vote
0 answers

How to avoid $oid in response of get by id in mongodb with java?

When performing the following code JSONObject jSONObject = new JSONObject(); MongoClient mongo = new MongoClient(mongoip, mongoport); DB db = mongo.getDB(mongodb); DBCollection collection =…
Sonal
  • 345
  • 1
  • 4
  • 8
1
vote
2 answers

MongoDB : Find/filter data by today date of birth without aggregation

I am working on the product where user can upload the data and the datatype for the data will be picked up by the user dynamically while uploading. I am storing the data in mongodb. User can write the rule on front end to segment the data. One of…
1
vote
1 answer

Document vs. DBObject confusion while moving from java MongoDb driver 2.13 to 3.3

I'm just changing my project from the old 2.13 to the new 3.3 java driver. Now given that Document is going to replace DBObject anyway, I thought I'd replace it. Everything works like a charm ... except that the (old) DB isn't accepting the…
Anders Bernard
  • 541
  • 1
  • 6
  • 19
1
vote
1 answer

Jersey : response with List

I want to send Json with Jersey. I use mongoDb. My function to return my objects : public static List getAll(){ List toReturn = new ArrayList(); DBCollection coll = Db.databse.getCollection("Roles"); …
damien marchand
  • 864
  • 1
  • 13
  • 30
1
vote
1 answer

Lists of DBObjects - Mongo Java Driver

I am making a game where there are kits in different multiplayer servers. Players can purchase kits, where it saves it to a Mongo database. I would like the database to be formatted like so: { "server": "the_server_name", "players": { …
user3322338
  • 23
  • 1
  • 5
0
votes
1 answer

How to view other users' objects like mine in Oracle SQL Developer?

When I access other users' objects, I can do something like select * from user_2.booking_table; given that I have the privileges over user_2's objects. Using the console, I know I can do alter session set current_schema=user_2; to avoid prefixing…
user2526586
  • 972
  • 2
  • 12
  • 27
0
votes
0 answers

MongoDb document update without model classes - dynamic objects

I am new to using mongo db - and trying to learn mongo template and db object and see how to do update and insert without writing the model classes for every documents. I will have a lot documents to update [ multiple collections also]. I will get…
Mmenon
  • 61
  • 6
0
votes
0 answers

How to get rid of 'dbObject' not found in fpdf?

I've tried a lot of things to solve this problem but, it's difficult to create a pdf using fpdf framework as a beginner. Here is my php codes. //generate_pdf.php
John Mark
  • 57
  • 8
0
votes
2 answers

array of DBObject with same keys each element

I am trying to create an array of DBObject, all of the elements have the same key with different values. what is the problem with this implementation ? DBObject[] Out = new BasicDBObject[2]; out[0].put("VALUE","1"); …
Ohad
  • 1,563
  • 2
  • 20
  • 44
0
votes
1 answer

what are the difference between document and dbObject when using MongoDB and Java?

what are the difference between document and dbObject when using MongoDB and Java? when will we use each of them?
Ohad
  • 1,563
  • 2
  • 20
  • 44
1
2