Stack Exchange Network

Stack Exchange network consists of 174 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

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

-1
votes
0answers
6 views

Import a .bson file using mongorestore [on hold]

I'm fairly new to mongodb I'm having trouble setting up my connection. I have a mongod server running in the default port. And I want to load a specific .bson file onto that server (assume I do not ...
0
votes
0answers
8 views

Can we have Mongo DB 3 node cluster with 3 master and 2-2 replicas

My requirement is, We need to setup 3 node MongoDB cluster in AlibabaCloud. Each ECS instance belongs to same account but different region. We are using VPC peering to connect those instance. Now we ...
-1
votes
0answers
6 views

How to create MONGODB gridfs bucket? [on hold]

how to create mongoDB gridfsbucket with name videos??
1
vote
0answers
11 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
0answers
6 views

How we can store MongoDB Installation on specific folder on Ububtu 18.04 LTS version rather than default one

I am newbie on Ubuntu Platform (Past was on Windows 10). I want to create specific directory where my MongoDB data will be store. Expectation of Designing the Structure Mongodb is a main Parent ...
0
votes
1answer
6 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;...
0
votes
1answer
42 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 ...
-1
votes
0answers
25 views

JSON Data Reading [closed]

I am new for Mongodb and I have a collection (table) with many documents (rows). Please find below for only 1 document (row). I want output for only two columns like user_id & answer_id and it ...
0
votes
1answer
33 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
19 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
26 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
35 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
24 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
17 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
37 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
44 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
15 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
29 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
33 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
20 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 ...
0
votes
0answers
7 views

What's the Javascript equivalent of mongodb's convertShardKeyToHashed function? [migrated]

I would like to know what is the Javascript equivalent of mongodb's convertShardKeyToHashed function.
1
vote
0answers
17 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
53 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
32 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
29 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 ...
1
vote
0answers
26 views

Horizontally Scaling Database Guide [closed]

We want to horizontally scale our existing MongoDB database which is running on one server. Due to increased user base, we can't scale it vertically anymore. We need to scale it horizontally through ...
0
votes
1answer
46 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
37 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
20 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
54 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
60 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"...
0
votes
1answer
20 views

if compact is required after move chunk

I have mongodb (wired tiger) with two shards. I added third shard and enabled the balancer. I can see the logs where the data chunks are getting moved to the new shard. After the movement of chunk ...
0
votes
1answer
32 views

Replica set with 2 members, 1 hidden, yet primary sometimes becomes secondary [duplicate]

I have a replica set containing only two members: test:PRIMARY> rs.config() { "_id" : "test", "version" : 8, "protocolVersion" : NumberLong(1), "members" : [ ...
0
votes
0answers
11 views

Create a single-server replica set only for watching on change streams

I have a MongoDB database which is of relatively low importance. I shovel data from home automation stuff into it (mostly sensor data, sunlight, switch states and so on) and don't need any replication....
0
votes
0answers
18 views

mongodb - monthly archival of data

Coming from a RDBMS background, this is what I have done in the past. Create a table with partitions based on a date field. There are typically three tables (partitions) - current (M0), previous ...
0
votes
0answers
22 views

Can not drop a collection on MongoDB

I have MongoDB with 3 mongoses, 3 shards and each shard has 3 replicas. When I try to drop a collection which is not sharded, the command returns true but the collection remains. mongos> db....
1
vote
2answers
32 views

Update single field in a document (document.update($set)?)

Can't seem to figure out how to update a single field. Whatever I try, to update one field (picture: "url") the rest of the fields are being removed and set to null. I use the following command now: ...
0
votes
1answer
51 views

Query sharded collection returns all the results from the primary shard AND from the other shards

I tried to set up a shard to test this functionality and maybe migrate some of our data into it. I followed the documentation guide https://docs.mongodb.com/v3.4/tutorial/convert-replica-set-to-...
1
vote
1answer
23 views

Amount of Data transferred out in mongorestore

I'm using MongoDB version 4 Consider I have a database with dataSize 15GB, storageSize 10GB. After I mongodump --gzip it, the file created is of 5GB. Now, If I'm restoring it to a remote machine (M2)...
1
vote
0answers
11 views

MongoDB replication on a single server [duplicate]

I am working on a project with a Mongo Database for storage. The current setup is one Virtual Machine with a single Mongo Database. We notice a performance degradation when executing some heavy ...
1
vote
1answer
22 views

Get latest data for specific identifier

I have an application that (mostly) uses only the very latest data available for a certain identifier (may consist of multiple columns/keys). However, these data may be bad or implausible. In these ...
-1
votes
1answer
16 views

Mongodb restriction on update to only allow “$push” operator

Mongodb V 4.0 I want to restrict a user's role by only allowing new inserts to the collection. Either as a new document, or as an append to the document. I don't want the user to be able to update(...
2
votes
1answer
112 views

How to restore from .wt files?

Environment Windows Professional 10 MongoDB 3.6.4 2008R2Plus SSL (64 bit) (before computer crash) MongoDB 4.0.2 2008R2Plus SSL (64 bit) (after computer crash) I have been developing locally, and ...
0
votes
1answer
25 views

dokku-mongo Export Database Error

dokku-mongo export Database command is showing error "This does not look like a tar archive" $ ssh svuser@dbexample.com $ dokku mongo:export database > backup.tar $ tar -xfv backup.tar tar: This ...
0
votes
2answers
26 views

Connecting to monogdb with string

I'm trying to connect to MongoDB using a MONGO_URL:. This particular database has a username and password. I've created a user to allow readWrite commands and that's the one I'm using. If I log into ...
0
votes
1answer
32 views

unable to add a range to a tag using sh.addTagRange command

Have setup a 4 node test shard cluster: 1- mongos 1- config server 2- shard nodes hosting 1 shard each for a collection. Cluster is working perfectly, but when trying to run the following command: ...
1
vote
1answer
141 views

How to restore Mongo DB tar.gz archive

Using the Mongo DB Atlas cloud service (MongoDB Version: 3.4.16), the below backup archive of a MongDB was generated: Cluster0-shard-0-1531635127-5b4b0df33b34b92b0f50a045.tar.gz In this file I can ...
0
votes
1answer
73 views

mongodb setFeatureCompatibilityVersion command not found

I'm trying to upgrade my mongodb from 3.2 to 3.4 and I try to set the compatibility version by: db.adminCommand( { setFeatureCompatibilityVersion: "3.2" } ) But it says { "ok" : 0, ...
0
votes
1answer
29 views

MongoDB secondaries become unresponsive during replication

We got 3 Servers running. One Primary, two as secondaries. Primary has 4 vcpus, 16 GB memory, both secondaries have 8 vcpus, 64 GB memory. Every night, we run a full sync with several large ...
0
votes
1answer
323 views

Can't start mongodb server using 'sudo service mongod start'

I'm trying to set up a dummy mongodb server on my local device so I can play around with it and make mistakes so that I can feel confident editing the actual server. I use the following code to start ...