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
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [mongodb]

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

1
vote
1answer
64 views

Best practices for Feed restructuring in a social app database

I have a social app, where users can post to the school they chose on registration. Each post can have a hashtag and a school (all pointers, (hashtag is optional, school is not)). Users see posts ...
2
votes
0answers
34 views

MongoDB - Best practices for Feed restructuring in a social app database [duplicate]

I have a social app, where users can post to the school they chose on registration. Each post can have a hashtag and a school (all pointers, (hashtag is optional, school is not)). Users see posts ...
1
vote
1answer
169 views

Disk block size for mongodb deployment

Why does Mongodb production notes have no recommendations about the disk block size? AFAIU, disk block size would have a considerable impact on a throughput intensive application. Does disk block size ...
0
votes
1answer
2k views

MongoDB - Mongoose query findOneAndUpdate() doesn't update/duplicates the DB

I am trying to save and update (upsert: true - creates the object if it doesn't exist) the result of the Web Api which contains multiple arrays of data to populate the stock chart. Each time I enter a ...
0
votes
1answer
56 views

Equivalant MongoDB query of MySQL date query with arithmetic operations

How we can perform the below given MySQL query in MongoDB preferably in MongoDB-4.0: SELECT *,ABS(TIME_TO_SEC(TIMEDIFF(now(), datefield))/3600) as hours, (field1*field2*field2+field3*(1/(ABS(...
0
votes
1answer
58 views

MongoDB - The connection is not disconnected for a long time

I am building a system that outputs information such as visit information and page transition of the user who visited the website to MongoDB, The MongoDB connection pool of the server of the web site ...
0
votes
1answer
195 views

Change in bind_ip value is not reflecting

I have mongo installed on Centos instance in AWS and I am connecting to the mongoDB server from my system. To connect from remote system we need to change bind_ip value to 0.0.0.0 in /etc/mongod.conf ...
2
votes
1answer
192 views

Mongodb replica set primary and secondary node conf fail when one slave is down

In my env, I had created MongoDB replica set conf for high availability so one server fails should be handled by other also in my conf I have 3 DB server and 1 arbiter too but, my slave's server ...
2
votes
1answer
31 views

Getting exception on running sh.status() command on MongoDB sharded cluster

I am running sh.status() command on my mongos instance of sharded Mongo cluster and I am getting below exception. mongos> sh.status() assert: command failed: { "ok" : 0, "errmsg" : "error ...
1
vote
1answer
107 views

Service Discovery for MongoDB

What is the best way of implement a Service Discovery like ETCD for use in a mongodb cluster? I wish have, 1 master for HA and two nodes, in my master i have a static ip, but nodes maybe can changes ...
3
votes
2answers
123 views

How to promote hidden mongo node to primary?

We are trying to implement DR setup for our mongodb replica set and currently three nodes in DR are configured to run as hidden nodes. We are trying to test failover to DR which will require promoting ...
1
vote
2answers
42 views

NoSQL or MySQL for storing API usage

I need to be able to track API usage in order to generate reports or charts later. I've been struggling to decide whether to use regular MySQL or something like MongoDB or Elastic Search which I don't ...
0
votes
1answer
67 views

Capturing mongo replica set state from mongo shell

I am trying to capture mongo replica set state from mongo shell. E.g. [root@server ~]$ mongo MongoDB shell version v3.6.8 connecting to: mongodb://127.0.0.1:27017 MongoDB server version: 3.6.8 rs0:...
5
votes
1answer
170 views

MongoDB Migrating away from RocksDB to WiredTiger

We have been working for some time with RocksDB as our engine and we are now trying to migrate to WiredTiger. We have some pretty big databases around 4~12 TB of data and according to the process ...
1
vote
1answer
140 views

unable to start mongod - Fatal assertion 28579 UnsupportedFormat

I was frequently getting Segmentation fault (core dumped). Not knowing what to do, I just restarted my ubuntu. Then tried repair which failed because of Segmentation fault. Now when I am trying to ...
1
vote
1answer
26 views

MongoDB failure scenario

Design Question- During data insertion, if MongoDB failed, can I try multiple retries? I have read somewhere it will retry only one time. What will happen if retry fail? Can I keep the failed ...
1
vote
1answer
41 views

Mongodb ReplicaSet Changing Config Format

I have a 3 node mongodb replica set which uses the old syntax (non-Yaml) syntax that I am trying to change to use the new Yaml syntax old syntax auth = true bind_ip = 0.0.0.0 dbpath = /var/lib/...
0
votes
0answers
30 views

Why slaveDelay is not respected by mongoDB replica?

I've seen related article below: Mongodb replica config slaveDelay but data still sync immediately My secondary node is set to be delayed by 3600 seconds: ... "members" : [ { "_id" : 0, ...
0
votes
1answer
45 views

How is the MongoDB backup snapshot transferred from Ops Manager to file system store?

I am using Ops Manager for backup and restore. In docs, it is mentioned that the initial sync between deployment database and Ops manager happens via streaming 10 MB compressed files. https://docs....
1
vote
1answer
65 views

MongoDB deployment across cloud and On Premises

We are planning to implement MongoDB as a stretch cluster which includes Primary secondary in DC 1, Secondary secondary in DC 2, Arbiter in cloud(DC 3) where DC 1 and DC 2 are on premise servers and ...
0
votes
0answers
151 views

Best design for this project - MongoDB many-to-many self reference

I'm new to MongoDB and I wanted to create a collection of users that can subscribe to other users (basically a self join). Which of the following way is better (if any) and why? 1: Store both the ...
2
votes
0answers
147 views

Should Azure host write-caching be enabled when using MongoDB's WiredTiger storage engine

I have several virtual machines on Azure running a mongoDB replicaSet with the WiredTiger storage engine. I'm not sure about the proper host caching option to set on the disks that contain the MongoDB ...
3
votes
1answer
154 views

MongoDB Facet Error pipeline requires text score metadata, but there is no text score available

I created a mongodb faceted pipeline that the following is a subset of: db.books.aggregate( [ { $facet: { "categories": [ { $match: { $text:...
0
votes
2answers
34 views

Co working Space DB architecture [closed]

I am trying to build a platform to share the empty desks in an office with someone outside the premises to utilize the space and generate some revenue. I am thinking of three major roles: Member who ...
-1
votes
1answer
33 views

MongoDb User with readWrite can create database

I dont understand why my user can create data base. The user "toto" with role "readwrite" on DB1 can create a DataBase (db2). And with the same account "toto" I can create a user and affect this user ...
1
vote
1answer
105 views

How to test whether unique index can be created in MongoDB?

I want to add a new unique compound index to our production system. Before doing the change, I would like to check whether the field combination is unique, i.e. will the index creation succeed or fail....
1
vote
0answers
343 views

MongoDB query: date range (but dates in collection are in NumberLong format)

I need some help with my MongoDB query. I was trying to count in collection the number of entries for a specific date (i.e. May 05, 2016), but dates in the collection are in NumberLong data type. So I ...
0
votes
1answer
744 views

sudo service mongod start returns error 100

I'm encountering the following error upon executing sudo service mongod start in terminal. mongod.service - MongoDB Database Server Loaded: loaded (/lib/systemd/system/mongod.service; disabled;...
1
vote
1answer
147 views

MongoDB aggregation $unwind and 1NF

I have a basic rhetorical/theoretical question for people experienced using both MongoDB and RDBMS. Surprised SO has no Data Munging or Data Engineering forum. In making an aggregation pipeline in ...
0
votes
1answer
75 views

What is the point of a consistent and partition tolerant multi-master DB Architecture as opposed to Master-Slave

I should emphasize that my question is in regard to CP (Consistent and Partition Tolerant) systems. A lot of widely used NoSQL databases such as Mongo and Redis seem to fall in the CP category. And ...
1
vote
0answers
25 views

Java app crash after shard failover

I am using a Mongo sharded cluster with 4 shards. All shards are a 3 members replica set with a PRIMARY with priority 1, a SECONDARY with priority 0.5 and an arbiter. The Mongo config server is a 3 ...
0
votes
2answers
437 views

Access denied when connecting to mongosqld with MySQL

I'm trying to connect to my MongoDB using MySQL through mongosqld. I have mongosqld running with a config file that looks like security: enabled: true mongodb: net: uri: test-db auth: ...
1
vote
0answers
139 views

mongodb aggregation query performance

We have a collection PurchaseOrder, it has embedded array of documents PurchaseOrderLines and another embedded document Warehouse. The record count is about ~4m for PurchaseOrder and each purchase ...
1
vote
0answers
193 views

Which is better schema for given discussion forum, MongoDB

Lets have two variants of nosql collection for storing discussion comments. Assume discussion, where is only one thread/root comment with 100 replies. A./ collection: discussion_thread (id, ...
1
vote
0answers
72 views

timeout while dropping database - MongoDB

Getting time out issue while dropping database from mongoDB. Database size is around 200GB. {          "code" : 46,          "ok" : 0,          "errmsg" : "timed out waiting for DBNAME....
-2
votes
2answers
39 views

What DB should I use in my case? [closed]

I'm writing a software in C# that downloads some data from a website and stores it in a DB daily. The data is cases that were processed at that day. Each case has attributes like case_creation_date,...
1
vote
1answer
858 views

MongoDB update multiple sub documents inside array, each according to a condition

I have a document like this: { wid: 1, items: [ {nid: 1, sent: 900}, {nid: 2, sent: 12}, {nid: 3, sent: 0}, {nid: 4, sent: 1} ] } Now consider I want to ...
1
vote
0answers
65 views

Choosing the correct shard key for MongoDB

I'm new to MongoDB. From the mongod documentation, I know that when choosing shard keys the key should always have high cardinality, so write operations are distributed to different shards (a kind of ...
-1
votes
1answer
34 views

MongoDB replica set configuration problem

I'm facing some issues when trying the following: I have a three-node MongoDB 4.0 cluster, no sharding, one mongodb instance as primary, the rest as secondaries. When I shut down the primary, one of ...
1
vote
0answers
149 views

getIndexes returns empty array on MongoDB collection

I'm trying creating indexes on a MongoDB collection and while they are correctly created and they work (I can see the index in the executionStats), the output of the getIndexes() function is an empty ...
0
votes
1answer
36 views

How Can I properly connect a replica set to split write and read with ApsaraDB for MongoDB

As Replica Sets in MongoDB store data in multiple copies for improved data reliability and high service availability. My Question is that: How Can I properly connect a replica set to split write and ...
1
vote
0answers
21 views

Help on understanding how _id works for Mongoose

So I've got a schema for a record that is shown below that will record three different types of events: (an example of one record that would be created that would be a segment in the test log) (log ...
0
votes
1answer
127 views

Why slower using multiple mongos?

When I use a single mongos like 1.1.1.1:30000, the driver will return in 20ms to find a batch of documents. When I use 1.1.1.1:30000,1.1.1.2:30000,1.1.1.3:30000,it costs 60ms,three times more to ...
0
votes
1answer
45 views

copydb, shutdown commands are not supported in ApsaraDB for MongoDB. Any Alternate Available

List of below mentioned commands are not supported on ECS - ApsaraDB for MongoDB. copydb clone clean shutdown repairDatabase repairCursor Is there alternate available for the same ? I appreciate ...
1
vote
1answer
84 views

Is it possible to mix mongod version in a sharded cluster

I'm playing around with sharded cluster and I'm thought I saw somewhere that different mongo version could live within the same cluster. For example : mongos : 4.0 configRs : 4.0 shardRs01 : 3.4 ...
0
votes
1answer
291 views

MongoDB - Split brain with 3 DC

I have mongoDB in 3 DC's. DC1 - 3 Nodes with priority 300 DC2 - 3 Nodes with priority 200 DC3 - 3 Nodes with priority 100 Questions :- Say, N/W is broken b/w DC1 & DC2. But, still DC1 is ...
0
votes
1answer
41 views

Permission Requirement to migrate MongoDB to ApsaraDB for MongoDB

I want to migrate my existing MongoDB 3.6 to ApsaraDB for MongoDB. What type of permission required for Migration. Is there any steps defined for MongoDB migration
0
votes
1answer
80 views

MongoDB - overloading PRIMARY with multiple replica set

MongoDB replica sets read data from Primary oplogs. So, Does it mean that having too many replica sets will put load on Primary node as all replica nodes will have to read data from Primary oplog? We ...
0
votes
1answer
159 views

Why MongoDB collections are dropped automatically?

I have installed mongodb 3.6 standalone instance and created some collections through insert query in mongo shell. My app points to the db server, the app creates some new collections, it reads, ...
0
votes
1answer
488 views

Query using $gte and New Date() working in MongoDB shell but not through python pymongo

When I run the following in the mongodb shell, it returns the correct number of records: (searching for the matching "SourceName" within the last 8 days) mongos> db.fdl.count({ SourceName : "SRC1"...