Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [mongodb]

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

0
votes
1answer
19 views

Single collection for multiple keys

I built a little setup with a raspberry pi and a temperature and humidity sensor. Every 5 minutes it reads sensor values and sends them both + a timestamp and a custom ID (there are multiple pis, each ...
0
votes
1answer
20 views

MongoDB specifying shard key and sharding strategy

What is the syntax to state that a collection is to be sharded as location based, while using the range based sharding strategy. I know you have to use the the sh.shardCollection() command, but what ...
2
votes
1answer
22 views

What is the meaning of “Monotonically Changing Shard Keys”?

I am writing my first pubblication concerning MongoDB and more specific MongoDB Sharded clusters. On the documentantion I found that the shard key in case of ranged sharding should be "Non-...
1
vote
0answers
32 views

Mongodb won't start after adding 2nd net option to mongod.conf file

I try to add another net with the its corresponding bind ip and port to my AMI ec2 mongod.conf file so I will be able to create a 2 node replica set but when I run the command "sudo service mongos ...
1
vote
1answer
33 views

Fastest way to move Collection from Sharded MongoDB Cluster to a another Sharded MongoDB Cluster

I have to move a MongoDB Collection (Size: 1TB+) from Sharded MongoDB Cluster to another[5 shards on both clusters]. During this operation, it is assumed that the accompanying program will be offline, ...
0
votes
1answer
39 views

How I can copy a collection from a Mongo Cluster to another Mongo Cluster? [duplicate]

I have a collection with more than 1 TB size and wanted to move it another MongoDB cluster PS: Both clusters are sharded over 5 shards and they are on-prem infra.
1
vote
1answer
30 views

How to monitor Mongo databases and Cloud servers?

We have mongo databases installed in AWS and Azure based servers. We need to monitor the Mongo databases and Cloud servers on daily basis. Is there any way to healthcheck the databases and servers ? ...
1
vote
2answers
101 views

MongoDB - Mongorestore is not working as expected

A Very Good Day, I have the user in the mongodb like below who has the superuser privileges (I confirmed the role setting using show users command) { "_id" : "admin.mongoadmin", "user" : "...
1
vote
1answer
23 views

MongoDB Too many open file while reSync member

I get the problem in many past days. I have MongoDB cluster with 3 shards and 3 replicas. 1 2 3 A O S S B S P S C P O P P - Primary state S - Secoundary state O - Other ...
0
votes
1answer
148 views

Our replica set config is invalid or we are not a member of it - MongoDB

I have started the mongodb server with replica set name 'rs01' enabled on port 27001. Then started another command window to start the mongo db on the same port. The status says the 'rs0' is not a ...
1
vote
1answer
63 views

32GB RAM needed to work with 200.000.000 rows in MongoDB?

I've been playing with a large dataset, consisting of a few tens of billions of rows of small ascii strings. I want to count the number of occurrences of each string in the dataset, and i suspect the ...
0
votes
1answer
29 views

Mongodb find() not working as expected, PHP [closed]

Mongodb find() seems Not to work, I have tried all I could and nothing works so far. using PHP7+ I have a Document in the strure like the image below In SQL I could do something like:SELECT....... ...
0
votes
1answer
24 views

I am trying to achieve a Disaster recovery for Mongo DB

Right now i have a MongoDb HA in site one and i need another site with asynchronous replication enables in another location.This is a base plan of mine to achieve a disaster recovery . I dont have ...
0
votes
1answer
23 views

documents don't go into newly added shard

I have added a shard to an existing cluster, and when I do db.printShardingStatus() I see a distribution: mongos> db.printShardingStatus() --- Sharding Status --- sharding version: { "_id" :...
1
vote
0answers
35 views

adding documents to shard collection results in incorrect amount

I have added 2 shards to my cluster: sh.addShard("127.0.0.1:27023") { "shardAdded" : "shard0000", "ok" : 1, "operationTime" : Timestamp(1552115819, 4), "$clusterTime" : { "...
-1
votes
1answer
21 views

Automate setting secondary node to primary when majority nodes are down-MongoDB

There are many ways to force a secondary node to become a primary when majority nodes are down in mongo replica set. But we need to do this manually. For eg, forcing reconfig: cfg = rs.conf(); cfg....
1
vote
1answer
23 views

mongodb sharding collection

Im trying to shard my collection. when I execute the command: sh.enableSharding("testdb") I get: { "ok" : 1, "operationTime" : Timestamp(1552083125, 2), "$clusterTime" : { "...
1
vote
1answer
21 views

changing domain name for Mongodb primary

Im trying to initialize my replica set sp that the primary node has a specific domain:port pairing. what I want is: "vagrant-ubuntu-trusty-64:27022" but what I get is: "localhost:27022" This ...
1
vote
1answer
44 views

Why mongodb logs commands in the log file and how to avoid that?

OS: Windows 10/ Server 2012 Mongodb verison : 3.4.9 I have set the mongod --logPath and --quiet command line parameter The logs are just growing beyond 100mb and not rotating. Seeing the logs I see ...
0
votes
1answer
31 views

advice on modeling schema to have better access to foreign entity

I am fairly new to modeling on MongoDB--please consider this simple example schema const userSchema = Schema({ name: String, username: String }); const addressSchema = Schema({ user: { type: ...
2
votes
1answer
79 views

MongoDB stepDown fails in a PSA Architecture

I have set up a MongoDB cluster using a 3-Member Primary-Secondary-Arbiter Architecture Environment: LXC containers Linux Debian Stretch (9.8) MongoDB server version: 4.0.6 MongoDB Containers: lxc-...
0
votes
1answer
26 views

3 Node mongo db authentication setup fails

I have 3 node mongodb replica set as below Primary node Secondary node Arbiter node Replication set is enabled for all three. I am trying to set up authentication for these nodes and i followed the ...
0
votes
1answer
20 views

MongoDB Replication Set Configuration Issue on CentOS 7

My mongodb instance will not run as standalone and I haven't been able to discover why. Its probably something simple. Please point me in the right direction. Linux myserver 3.10.0-514.el7.x86_64 #...
0
votes
1answer
27 views

deploy replicas on multiple VMs

How do you set up a multi-node replica set in Mongodb? I don't know where to start. I'm trying to set up a replica set of three members in three virtual machines, i.e. there will be a total of three ...
1
vote
1answer
43 views

Is there a way to store int in ObjectID? [closed]

I'm trying to migrate MySQL user ids to MongoDB. user ids are incremental values like 1,2,3,4... Is there a way to store int in ObjectID?
1
vote
1answer
30 views

Sharding the Existing MongoDB

I've got 3 dedicated non-virtual servers (srv1-3). On one of them (srv1) i've got MongoDB in production, that already have got really big amount of data. At the present time there is no sharding or ...
0
votes
0answers
39 views

Transaction on defriend and multi databases

I have a big issue when i'm working with multi database and diffrent databases as same time. The problem is that I'm working with mssql, mysql and mongodb at sametime, and what I need is a way to be ...
0
votes
1answer
26 views

Can't change MongoDB default DB path

I know there are multiple questions on the same issue and I followed them but not sure what is happening here. First of all I am trying to change the default db path to a a separate mounted disk. And ...
1
vote
0answers
44 views

mongodb “WriteConcernFailed” on a replica set

I have a replica set of 4 members. 1 primary, 1 arbiter, 1 secondary, and another one that should be secondary, but have issues and is not connected. (in a "connecting..." state). When the ...
0
votes
0answers
16 views

MongoDB Script Fails in the cluster

I am trying to do a database operation for a MongoDB database hosted in Compose.io. My mongodb script is db.getCollection('companies').find({}).forEach(function(company){ var oldHosts = company....
0
votes
0answers
24 views

Mongodb - add new node secondary in existing replica set shard

my mongodb configuration which i am trying to add. systemLog: destination: file logAppend: true path: /var/log/mongodb/mongod.log storage: dbPath: /var/lib/mongo/mongo journal: enabled: ...
0
votes
1answer
26 views

What is mongodb logging as a COMMAND?

Relating to mongodb's documentation, database commands such as count will be logged as component COMMAND. However neither db.count() nor db.runCommand({count:'mycollection'}) produces a COMMAND log ...
0
votes
1answer
50 views

How to efficiently design Firebase database for Home service Booking application? [closed]

I'm planning to build my own app. It's a home service App to link users with other providers. I'm recently used a NoSQL database, Firebase, and I am stuck with the design of the database for my app. ...
0
votes
1answer
82 views

MongoDB 3.6 crashed due to invariant() failure

MongoDB crashed twice in 6 hours today due to invariant() failure. We have been using MongoDB 3.6.3 for more than a year now, but this is the first time that we saw this issue. The extract from the ...
1
vote
1answer
30 views

MongoDB does not allow to create unique partial index in field that contains null

I'm using MongoDB 3.6.9 (with Ubuntu) to save a set of documents that contain one field named rss_id and for some documents, this field has the value null. I want to create a unique index in that ...
0
votes
2answers
32 views

MongoDB - changing data directory name changes data

I am witnessing a very bizzare behaviour of MongoDB. I launch MongoD on a test system (Windows 10, 64bit) like this: "C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe" --dbpath "C:\MongoData" I ...
1
vote
1answer
35 views

MongoDB sharding and zone tag that has a range of 1 key value

Suppose I have a zone tag that has a range of exactly 1 key value, such as the letter A. Further, suppose I assign this zone to two shards. Will the data with a shard key of A be put on both shards? ...
1
vote
0answers
46 views

Mongodb secondary reads data at 100% 24/7

We have a Mongodb 4.0 database, running a replica set with 3 members. Total database size is about 800GB. All of the members are running in docker containers. Docker shows that the master container ...
1
vote
0answers
19 views

MongoDB ticket availability reaching zero

I recently came across intresting issue. I have a sharded cluster which has two replication sets with 2 secondaries. On my primaries, there were 300-400 connections at a point in time, shortly after ...
1
vote
0answers
11 views

Joining on nearest timestamp in MongoDB

MongoDB version: 3.2.11 Coming from using primarily PostgreSQL, I am new to MongoDB and am having trouble constructing complex queries in the required JSON format (where in SQL I would use CTEs). To ...
1
vote
0answers
35 views

Noob Questions - Database approach

I have a database of "records" that relate to photos - title, location, text, tags, etc. I am now adding more fields for other media types, videos for example will get an transcript, audio will get ...
0
votes
0answers
44 views

MongoDB count() query returns outdated result in mongo shell / python script

Documents in my MongoDB collection are changing status field very frequently. I can observe it using a mongoDB client (Robo 3T). Now I'd like to monitor this process using mongo shell (or python ...
0
votes
0answers
69 views

Mongoexport and mongodump disk usage rationale

I just had an interesting experience with the mongoexport tool and came out with a doubt about the exporting process' disk usage. I was trying to dump a 50 MB collection to a disk that had 3 GB free ...
0
votes
0answers
26 views

Fetch only those record which do not have matching amounts

I have a mongo collection as shown below { "_id" : ObjectId("5c5c86633b897535539c1b36"), "studentId" : "dsdlkjafhiuelfdldahfiu", "marks" : [ "subject" : "Physics", "...
0
votes
1answer
64 views

Mongoexport halts when it reaches 101 records

I'm trying to dump a MongoDB collection from a remote server to a local JSON file. First, I do some ssh port forwarding to begin with: ssh -NL 12345:localhost:27017 $REMOTE_USERNAME@$REMOTE_HOST &...
0
votes
1answer
27 views

Mongo Ops Manager Cant Find process for member

When starting mongo ops manager and checking mongodb process it shows 0 mongods, and in system warnings throws the warning "Unable to find process for member XXX:27020 in rs_1" I can conect from all ...
1
vote
1answer
395 views

Getting error while creating a New Connection using Studio 3T for Mongo DB

I tried to create a new connection with Studio 3T for Mongo DB. I don't have a previous DB connection and this is the new one that I am trying to create it. I can't able to figure out why this is ...
3
votes
1answer
122 views

Hosting Multiple MongoDB Databases on the same MongoDB Instance/Cluster

In MongoDB there are the following conecpts: A MongoDB database exists as a logical unit on a MongoDB Instance which is either a singleton or a cluster running within some number of mongod processes ...
1
vote
1answer
54 views

MongoDB UserNotFound when starting mongod

I have a MongoDB version 2.4 that i wish to upgrade to 4.0. The official solution is to upgrade from 2.4 to 2.6, then to 3.0, and so on. I am attempting to upgrade from 2.6 to 3.0, and also to change ...
-1
votes
1answer
35 views

MongoDB Performance of Overwriting an Array Field vs Individually Updating the items

The problem I am facing is basically updating the inventory when an order is received in a MongoDB database.The general hierarchy is as follows Manufacturer: { ... Items: [ ... ...