Questions tagged [mongodb]

All versions of MongoDB - a scalable, high-performance, open source, document-oriented database.

Filter by
Sorted by
Tagged with
0
votes
0answers
9 views

Create user for all databases in mongodb

How to create a user and grant him read-only access for all databases available in mongodb(2.2/2.4/2.6) instance. I am new to mongodb, please provide detail step by step process. user name: sec.ai ...
0
votes
0answers
8 views

How to prevent starting of MongoDb 3.0.3 instance without “--auth” parameter?

I have a local Mongo database for which I have created users and authenticating through my code. But the authentication is only valid if mongo instance is run with "--auth" parameter. If ...
0
votes
0answers
9 views

How to aggregate distinct items in mongo db to separate array? [closed]

I have an API endpoint that checks the mongo db and returns in a following structure for example: { "Name": "Test" "Location": "Whatever", "...
0
votes
0answers
6 views

Mongo Atlas connection error type=UNKNOWN, state=CONNECTING

Yesterday I've seen some strange behavior that my application can't connect to Atlas. This has never happened before for about 1 year, and there was no application deploying going on. The error that ...
1
vote
1answer
13 views

Efficient way to get data for each date range intervals using single query | MongoDB

I have collections about products and purchases. I need to get statistics for each time interval. I need following: Name quantity (date 1 range) quantity (date 2 range) Name One 500 400 Name Two ...
0
votes
0answers
18 views

MongoDB 3.6.21 crash and not reIndex

I try to reIndex() my collection but not working and It removed all indexes. I checked mongod.log and see: 2021-01-18T05:56:59.492-0600 E STORAGE [conn1] WiredTiger error (5) [1610971019:492802][...
0
votes
0answers
24 views

queryHash field not available in mongos slow query logs

Mongodb V4.2 has introduced queryHash in slow query logs to identify slow queries with same query shape. While this queryHash is available in slow query logs in mongod logs (shard server), it is not ...
0
votes
0answers
6 views

Rotating MongoDB Replica Set Internal Auth Certificate Authority

I noticed that for replica set internal authentication all MongoDB instances must have certificates signed by the same CA. (Source) Rotating individual certificates is sensible, but if I wanted to ...
0
votes
0answers
4 views

MongoDB numerous slow query logs with zero keysExamined

using a MongoDB version 3.6 Replica Set, I am wondering why a query that resulted in no key examination and document examination would result in being slow. For example, I have numerous slow query ...
1
vote
0answers
9 views

Want to add more options on User database schema to premade users

So I have this User MongoDB Schema, and I want to add other options to it. but if I do then the current users have to create a NEW Account to see the new changes. is there a way to update all the ...
0
votes
1answer
24 views

show users doesn't show anything, although it has users

So I'm using MongoDB, and this is my first time dealing with a VPS on my own, I'm trying to view the users i have on the website. I know for a fact that there are signed up users, because I can signup ...
0
votes
0answers
12 views

Why is my mongodb setup not reaching EBS IOPS limit?

I have an application that is constantly pumping data to MongoDB. MongoDB instance is running with 2-replicas, each with 3TB gp2 EBS volume. As you can see on the following graph of irate(...
1
vote
1answer
31 views

Not able to connect to Mongodb vie mongo shell

I am no able to connect to mongodb via mongo shell. command: sudo mongo --tls --tlsCertificateKeyFile server.pem --tlsCAFile CA_INTERMEDIATE --host "mongodb://xxx:xxx@some-url:27020/data_base?ssl=...
1
vote
1answer
34 views

What is the getdate() equivalent for MongoDB?

I have a query to update and set some values in some fields. Obut Now I need to update these field and in adition, I need to set DateOfModification to the current date and time. What is the equivalent ...
-4
votes
1answer
29 views

Doing query with website [closed]

I want to create a website and I have a data set of schools locations stored in Mongodb . There will be a search box on my website and when I search for the name of the school, I want to get the ...
1
vote
0answers
24 views

Fetching nth document based on integer array in MongoDB

so let's say I have a random array of n integers [23, 2, 78, 99, ... ] where 0 < n < collection.count(), and each element is within this range as well. In my collection, it is currently indexed ...
0
votes
1answer
22 views

Is it possible to replicate a collection in MongoDB

I would like to replicate/synchronize a collection named "CollectionA" from a mongoDB "DataBaseA" to a mongoDB "DatabaseB" in real-time DatabaseB is a normal database (...
1
vote
1answer
33 views

Why aggregate query with lookup is extremely slow?

I have a mongodb query that works but takes too long to execute and causes my CPU to spike to 100% while it is executing. It is this query here: db.logs.aggregate([ { $lookup: { ...
0
votes
2answers
37 views

unable to aggregate and group by on one particular field

I'm trying to find $avg of some values but the aggregate and $group isn't doing what I expect. First, I confirm I have some test records as follows: db.reportgraphs.find(); { "_id" : ...
0
votes
1answer
14 views

In MongoDB, $setIsSubset does not make efficient use of index

Data: student class s1 ["english"] s2 ["maths", "geography"] ... sN ["history", "english"] The field "class&...
0
votes
1answer
29 views

Error when add new host shard server

I am getting an error when shard the existing collection. Can you help me? This my error {"t":{"$date":"2020-11-23T15:11:05.331+07:00"} ,"s":"I", &...
0
votes
0answers
16 views

Can the Atlas search filter in MongoDB cloud be used to query between dates?

All the examples I read online seem to refer to using the compass or the command line, not MongoDB cloud. I try emulate the same query code in the search filter but not having any luck. For example ...
0
votes
0answers
44 views

Mongoose subquery with additional filters

I'm new to mongoose for nodejs. I'm trying to do the equivalent of SELECT * FROM activityLogs WHERE activityLogs.id NOT IN ( SELECT activityLogId FROM graphs WHERE graphs.createDate >= '...
1
vote
1answer
28 views

MongoDB + Compass exporting strings and numbers “columns” with value of 1 as “true”(boolean) and 2 or null as “false” to CSV

When I export my MongoDB collection to a CSV, the String and Number "column" data types values are converted to "true" for 1 and "false" for 2 and null - how do I retain ...
0
votes
1answer
35 views

How do I import the _id index from a MongoDB collection as a hash index for a PostgreSQL table (from a CSV export from MongoDB)?

I want to be able to keep track of the _id index values that get the MongoDB collection uses when I export the MongoDB collection (via CSV) and import the data into a PostgreSQL DB table (basically ...
0
votes
1answer
32 views

Even with 90000 NOFILE mongo crashes with Too many open files in system

we suddenly got MongoDB servers crashing on docker container mongo:4.4 with this error: couldn't open [/proc/1/stat] Too many open files in system","file":"src/mongo/util/...
0
votes
1answer
31 views

Read Concern Majority when majority nodes are down

I have a 6 node replica set (all of them data bearing) with 5 voting members. If I lose 3 voting members, I will not have a majority voting members and my replica set will become read-only. In this ...
0
votes
2answers
44 views

MongoDB covered query needs to fetch and examine documents when exists operator is used

I need to execute following query on mongo db: db.testCollection.find({ dataType: { $exists: true } }, { _id: 0, date: 1 }) .sort({ date: -1 }) .limit(1) so basically only I need to do is to ...
1
vote
0answers
25 views

Which NoSQL for storing images as 2D arrays (BLOBs)

I have large number of images that I need to access on per-pixel-basis in my app. The images are downloaded from web and are quite large (4k). Update is done several times a day (tousands of images), ...
2
votes
0answers
37 views

mongorestore --drop slow on small db

I'm using a real Mongo instance for my integration tests. On every test, I call mongorestore my_db_state --drop because I need a clean db to start the next test. On my tiny db (with only one test user ...
1
vote
0answers
22 views

Notification for host failure and health status [closed]

I set up a MongoDB cluster with replica sets. I wish to have something like a dashboard or a "health status". My current solution is to connect to the cluster and query the replication state ...
1
vote
0answers
23 views

mongodb switches from primary state to secondary during script

I have a mongodb replicaset setup using bitnami/helm which lives on my k8 cluster. I have a cron job that runs every night to store data in a my mongo db. It often fails when it tries to connect to ...
0
votes
0answers
23 views

MongoDB 4.2 Shard Cluster: what is db.cache.chunks.DB and how to flush it

Here is my MongoDB cluster (I didn't draw about Mongos but exist) I made "news_cat" db and created some collections and I did sharding. I delete DB ("news_cat") in Mongos using db....
0
votes
1answer
280 views

mongodb replication failed with socketexception and listener

I'm trying to set up mongodb replication using two servers in different data center. For the purposes of this question, I'll say their IP address are 1.1.1.1 and 2.2.2.2. I installed a clean version ...
0
votes
0answers
16 views

MongoDB too many forked processes

We are having an issue with the MongoDB high usage memory, this is an AWS EC2 server running only MongoDB on docker container. total used free shared buff/cache ...
0
votes
1answer
14 views

How many cluster must i created on MongoDB Atlas?

I want to implement MongoDB transactional. But there is a term that must not single alone server. So, how many clusters must I create to an implement that?
0
votes
1answer
51 views

MongoDB high usage WiredTiger

We are having difficulty with MongoDB high RAM usage in AWS EC2 Instance ubuntu with 30GB RAM. In our server, there are over 3K databases and It's out of memory from time to time. I read a lot about ...
0
votes
2answers
29 views

MongoDB Collection Level Permission Issues

I am trying to set up a MongoDB user that only has access to certain collections across several databases. The issue is that these databases are created dynamically at runtime. I decided to employ ...
0
votes
0answers
34 views

How does wired tiger write changes in mongodb?

Been trying to get the very basics of how wiredTiger (WT) works in MongoDB. I'm only interested in 3.6+ But the docs aren't enough on this matter. This is what I got by bits: Standard behaviour Write ...
0
votes
1answer
34 views

Nested push in Mongoose

I have a user schema like that: name: String, nick: String, email: String, password: String, bio: String, color: String, followers: [String], followings: [String], posts: [{ author: { ...
0
votes
1answer
30 views

Multi-tenant reduce number of MongoDB connections

Our multi-tenant app has about 4000 databases per tenant and we are having a problem with performance because of too many connections. Creating MongoDB connections on each database is a heavy ...
0
votes
1answer
688 views

mongo user can not connect from bash on localhost

In mongo shell, I ran the following commands: use mydatabase db.createUser( { user: "john", pwd: "mongopass", roles: [ "readWrite", "dbAdmin" ] }); Mongo ...
0
votes
2answers
190 views

MongoDB - _id as String instead of ObjectId ? Relationship between collections or duplicate data?

Scenario: An entity called 'accessPoint' has an important attribute called 'network'. The application will display some parts of this network attribute, so I decided to store it inside accessPoint ...
0
votes
1answer
27 views

When and how to create users in a MongoDB sharded cluster

I hope my question is clear enough. I'm setting up a sharded cluster, 3 members, each running as a replica set. So, on each shard there are 3 mongod running as replica sets. My question is what ...
0
votes
2answers
33 views

MongoDB cross datacenter replication without elections or high data availaility

I want to replicate a MongoDB database to another node, located in another datacenter. This is to help guard against data loss in the case of a hardware failure. We don't want/need high availability ...
0
votes
1answer
63 views

Is there any way to disable MongoDB's cache?

I'm not getting recent data when querying, and I believe it has to do with cache. Probably, MongoDB's cache invalidation fails somewhere. I'd like to disable it completely and I don't care about ...
0
votes
0answers
33 views

Mongodb Upgrade from 1.8.2 to 4.4

I would like to upgrade Mongodb version 1.8.2 with replica set available ( 1 primary, 2 secondary) with same version to version 4.4 with no downtime. What are the steps do I need to follow in order to ...
2
votes
0answers
20 views

MongoDB - 100% CPU - recovering shard (after killing updates)

Can a recovering shard (as shown below) drive CPU to 100% for hours and hours? I have killed all the queries and updates (based on db.currentOp()) and stopped the flow of new data, but the CPU stays ...
1
vote
1answer
19 views

MongoDB: Queries running twice slow on NEW server compared to OLD server

I transferred current/old running DB into a new standalone server for MongoDB. To do this, I performed the following: Took dump of data from OLD server Restored data from the generated dump into NEW ...
0
votes
0answers
19 views

Query doesn't return data that's written recently

I have two micro services where one write to DB and another read from DB. The first micro service is written in C++ while the other is written in NodeJS. When querying for data say for a IP the ...

1
2 3 4 5
44