mongodb-java Questions
11
Solved
This is my first attempt to consume MongoDB. I've got Mongo running:
ps -ef | grep [m]ongo
mongodb 11023 1 0 Jun24 ? 00:00:03 /usr/lib/mongodb/mongod --config /etc/mongodb.conf
And the error com...
Gareth asked 27/6, 2011 at 21:41
4
Solved
I am using mongo database for my application
for connection spooling in configured the below mongoOption while creating connection
MongoOptions options = new MongoOptions();
options.autoConnectR...
Quadratics asked 14/3, 2014 at 12:14
2
Solved
I want to run the following command to create a user with MongoDB Java Driver,
client = new MongoClient(mongoClientURI);
MongoDatabase database = client.getDatabase("db_1");
Document createUse...
Roughandtumble asked 23/11, 2016 at 7:7
2
Solved
I am newbie to mongodb.
We can execute list of queries by specifying it in a script .sql file in relational db and can run it by running the command source c:\test.sql.
For instance
CREATE DATABASE...
Bambino asked 31/8, 2012 at 11:16
11
Solved
How can I sort a MongoDB collection by a given field, case-insensitively? By default, I get A-Z before a-z.
Stowe asked 8/4, 2014 at 8:8
4
Solved
Am trying to write a JUnit test case for below method, am using Mockito framework.
Method:
public EmplInfo getMetaData(String objectId) {
objectId = new StringBuffer(objectId).reverse().toStrin...
Napier asked 22/6, 2018 at 12:28
3
Solved
We have a simple application in which we have all user in same timezone & therefore we are not interested to store timezone information in mongo date object.
Reason for such extreme step is w...
Cambria asked 15/7, 2016 at 16:43
2
Solved
Our previous implementation for finding distinct elements from a collection used to be :
List<String> names = mongoClient.getDB(dbName).getCollection(collectionName).distinct(NAME_KEY);
Tr...
Stratify asked 25/10, 2016 at 17:39
3
Solved
I'm new to Spring Data with MongoDB and would like to have an automagically generated query method inside my MongoRepository extension interface which requires filtering, sorting and limiting.
Th...
Seepage asked 8/4, 2012 at 22:45
8
Solved
I am trying to find documents in MongoDB by searching on "_id" key. My document looks like this-
{
"_id" : ObjectId("4f693d40e4b04cde19f17205"),
"hostname" : "hostnameGoesHere",
"OSType" : "OST...
Ripsaw asked 21/3, 2012 at 2:43
7
Solved
I get this error on a find call (default Java Driver) after a period of inactivity. I tried to add a manual heartbeat (writing to a capped collection), but it didn't help. I only get the issue whil...
Issi asked 22/8, 2016 at 12:42
5
Solved
What is the difference between createIndex() and ensureIndex() in Java using MongoDB? I googled this but didn't get a satisfactory answer.
Daimyo asked 22/9, 2014 at 7:21
4
Solved
I am trying to come up with a concept to take a query string and have it passed into something like this via a query object:
returnList = mongoTemplateTracking.find(query,TrackingData.class, COLLE...
Salenasalene asked 28/8, 2014 at 18:50
6
Solved
I am newbie to mongodb.
I need to insert a doc without the _id field generating automatically.
I need to set the field Tenant_id as unique or need to change the "_id" field to Tenant_id.
how to...
Caitlin asked 11/9, 2012 at 21:40
0
We have a mongo db replica set configuration with 1 primary and 2 secondaries. We have set the read preference to primary because one of our secondary is in a remote region and do not want read ope...
Xanthate asked 18/6, 2022 at 13:6
7
Solved
I am newbie to mongodb. May I know how to avoid duplicate entries. In relational tables, we use primary key to avoid it. May I know how to specify it in Mongodb using java?
Adenosine asked 30/8, 2012 at 6:47
19
Solved
Given this document saved in MongoDB
{
_id : ...,
some_key: {
param1 : "val1",
param2 : "val2",
param3 : "val3"
}
}
An object with new information on param2 and param3 from the outside w...
Funds asked 24/4, 2012 at 1:33
3
Solved
What is the difference between the cursor.count() and cursor.size() methods of MongoDB's DBCursor?
Omnipresent asked 9/8, 2012 at 10:25
4
Solved
I understand that there are many questions which as for the same and they are answered well. The problem is all those questions use MongoDBObject, MongoDBList to retrieve arrays. My problem is I am...
Gustavo asked 23/8, 2015 at 6:39
2
Solved
I just upgraded my mongo-db-java-driver and now the handy function GridFSBucket.uploadFromStream has gone. Therefore we now got a
GridFSUploadPublisher<ObjectId> uploadFromPublisher(String fi...
Directive asked 17/9, 2020 at 20:20
3
Solved
I have a mongodb collection term with following structure
{
"_id" : "00002c34-a4ca-42ee-b242-e9bab8e3a01f",
"terminologyClass" : "USER",
"code" : "X67",
"terminology" : "some term related note...
Scholasticate asked 14/5, 2015 at 7:49
3
Solved
I'm having trouble diagnosing an issue where my Java application's requests to MongoDB are not getting routed to the Nearest replica, and I hope someone can help. Let me start by explaining my conf...
Royall asked 2/9, 2015 at 21:54
3
Solved
I've a Java application that performs some aggregations on MongoDB, but sometimes it just hangs and throw a SocketTimeout exception. After the Exception the app will run just fine (for a bit, then ...
Phylloquinone asked 24/2, 2016 at 9:19
7
Solved
Is there a simple way to convert Simple POJO to org.bson.Document?
I'm aware that there are ways to do this like this one:
Document doc = new Document();
doc.append("name", person.getName()):
B...
Larhondalari asked 4/9, 2016 at 19:43
3
I am using the MongoDB Java Driver for my project to access my database from Java.
I usually use Document as it's quite easy to use and all methods in MongoDBCollection, such as find() work with i...
Insane asked 13/3, 2018 at 18:1
1 Next >
© 2022 - 2024 — McMap. All rights reserved.