Questions tagged [mongo-collection]
110 questions
2
votes
1 answer
How come mongodb timeseries have duplicate _id
I just realized mongodb timeseries two or more documents can have the same ID.
Is that normal?
user12007608
2
votes
0 answers
MongoDB partitioning
Is there any semantics like collection partitioning in MongoDB? My data is very huge, per day more than 100 000 line data is recorded. in order to retrieve for the report takes some time for the selected device. If data gets logged daily,…

Premkumar Jayaraman
- 21
- 2
2
votes
1 answer
Java use MongoCollection.countDocuments() executes slowly or even times out but deprecated count() method is ok
Bson filter = Filters.and(Filters.eq("appId", appId),
Filters.eq("ch", ch.getCh()),
Filters.gte("updateTime", startSeconds)
);
long c = mainCollection.count(filter); //run ok quickly,…

夏申洋
- 21
- 3
2
votes
2 answers
Trying to update a document using MongoDB Java Driver
Thank you
I just want to thank you for clicking on this question! I've tried my best to make this as thorough as possible.
but still, feel free to let me know if you need to clarify anything further!
if you think the question is too long. you can…

Programming Donkey
- 87
- 9
2
votes
1 answer
MongoCollection.find() does search twice?
I am using the code snupped as below :
if (collection.find(toFind) != null) {
dataFound = collection.find(toFind).first();
} else {
System.err.println("NULL");
}
As collection.find() is being called twice…

Chirag Mehta
- 25
- 1
- 6
2
votes
2 answers
How to lookup data from 2 collections in MongoDB using python
I need read 2 collections data from MongoDB in Python, is there any way to join data in python?

Dileep Devang
- 43
- 1
- 4
2
votes
1 answer
How to generate Mongodb documents recursively using mongocxx c++ driver?
How to generate Mongodb documents recursively using mongocxx c++ driver?
1. I use mongocxx c++ driver v.3 and c++11.
2. Here is my main.cpp method, which parses hex string and generate mongocxx code like this:
console:$ ./main dissect…

Evgeniy Boytsov
- 214
- 2
- 8
2
votes
2 answers
Insert a document into another document in MongoDB
I'm trying to add a document in another document.
I am trying to insert a new document with a timestamp as a key and light prox and temp as the content of that document into document sensor_collection.
It's logical that my code doesn't work,…

Martijn Jan Jaap de Bruin
- 721
- 1
- 8
- 19
2
votes
1 answer
Solr indexing of MongoDB collection
Suppose I have a test application representing some friends list. The application uses a collection where all documents are in the following format:
_id : ObjectId("someString"),
name : "George",
description : "some text",
age : 35,
friends : {
…

user1949763
- 3,583
- 3
- 16
- 12
2
votes
1 answer
Retrieving MongoDB Subdocuments with Node.js and Express.js
I created a RESTful API using node.js, express.js, and mongodb. I started creating my routes by pulling documents from a MongoDB collection which work perfectly.
Example Collection Document
{
"_id" : ObjectId("51ace8c04cc8ea865df0923e"),
"title" :…

W Rachell
- 21
- 2
1
vote
1 answer
How to specificy path of new collection in Mongo DB?
I am running Mongo on Windows 10. Data access is made trugh Pymongo (Python). All my data is stored in an old large HDD, but I would like to have some smaller collection stored on a much faster SSD? When I create a new collection either trough…

Andrea Barral
- 91
- 3
1
vote
1 answer
MongoDB - How to retrieve only one specific document from a collection
I have created a database called "Cars" and a collection inside it as, "Cars_info". I have inserted 8 documents inside it as follows.
db.Cars_info.insertMany([
{ car_id: "c1", Company: "Toyota", Model: "Aqua", Year: 2020, Price_in_usd: 25000,…

RUNR
- 29
- 6
1
vote
1 answer
MongoDB Collections Schema and Data Model
I am new to MongoDb, we are using it in a .netCore application. The issue I am facing is to manage changes in our schema. If we have additional fields in our DB collection which are not present in our DB model in our code, can we force MongoDB to…

Arifa
- 11
- 1
1
vote
0 answers
When creating data in MongoDB, there was an automatically generated value, how can I control it?
First, I will show you two pictures of data recorded in MongoDB Compass.
[User Collection]
[Plan Collection]
As you can see I get only 3 values from the user in the User collection: name, phone and address. It is understood that _id is…

H.JiMan
- 269
- 1
- 2
- 10
1
vote
0 answers
MongoCollection to Java List
I have a Java object that looks like this:
public class Partner {
private String partnerName;
private String partnerRef;
private Site sites;
I have this stored in MongoDB as a document. I am attempting to retrieve it like this:
…

Eric
- 65
- 6