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

Questions tagged [mongodb]

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

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
100 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
42 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
64 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
185 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
40 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
48 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
111 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
375 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
38 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
167 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
1answer
43 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
1answer
32 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 ...
1
vote
2answers
189 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
169 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
29 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
26 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
22 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
336 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
44 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
34 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
56 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
379 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
275 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
41 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
1k 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 ...
0
votes
1answer
74 views

Mongo doesn't restore user password

I have following scenario: Dump Mongo database (cmd mongodump) Change password from one of admin users Restore Mongo database (cmd mongorestore) EDIT: I use following command for db dump: ...
1
vote
0answers
75 views

Mongo 4.0 replicaSet recovery SegFault

After doing rs.initialize() on two repica instances (aws ubuntu 16.04) and mongo 4.0.1 I get the following SegFault which I assume happens during replicaset recovery. Is it a mongo 4.0 known issue? ...
1
vote
0answers
105 views

MongoDB Warning impossible to clear

I'm using Ubuntu 16.04 and MongoDB 4.0.1. When I use mongo shell I got this : I STORAGE [initandlisten] I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with ...
9
votes
2answers
5k views

Mongodump: Unrecognized field 'snapshot'

I am using mongodump from mongo tools to download a backup of my server. However as I run the command, the command returns "Unrecognized field 'snapshot'". The full error is: Failed: error reading ...
0
votes
1answer
237 views

Connecting to a self signed mongodb server though mongo shell doesn't require `pem` file

I am using nodejs mongodb driver to connect to a self signed mongodb instance. The MongoDB and Mongo Shell version is 4.0.0. Below is the command to launch a self signed mongodb instance: mongod --...
1
vote
0answers
66 views

Auth failing when using Devart ODBC connector to mLab

I'm trying to connect PowerBI to a mLab-hosted Mongodb instance. I first tried installing the MongoDB BI-connector, but after installing it didn't show up on the drivers list in Windows ODBC manager (...
1
vote
0answers
22 views

How to do a find query on the result of another find query?

I'm working with MongoDB because the company where I work is doing a migration from pSQL. We have reports with filters: first the report lets you select a range of dates by year and month, then you ...
0
votes
1answer
132 views

Connection error while installing mongodb on fedora 28

I have been trying to install Mongodb but it keeps failing midway. When the download is complete, installation fails with a connection error: MongoDB shell version v3.6.3 connecting to: mongodb://127....
1
vote
1answer
362 views

Get the size of list of documents in mongo db

I want to get the size of the list of documents in mongodb. db.getCollection('eventDetails').find({"dateTime" : { $gte : new ISODate("2018-05-01T12:00:00Z") },"dateTime" : { $lte : new ISODate("2018-...
1
vote
1answer
212 views

How to permanently enable Read Access for MongoDB Secondary Node?

Upon trying to connect mongodb secondary node from application : 08:11:2018 16:01:00.552 - error: A hook (orm) failed to load! 08:11:2018 16:01:00.558 - error: Error: Failed to connect to MongoDB. ...
1
vote
2answers
45 views

Mongodb Products schema with proper indexes

I'm totally new to mongodb with a MYSQL background. I'm working on an e-commerce website with some millions of products So we decided to migrate from MYSQL to mongodb. So far this is the products ...
1
vote
1answer
169 views

How many files are created by default using WiredTiger storage engine?

So, I got a question on a test (without answer unfortunately) that left me with a big doubt whether it's true or false. The question is this: "By default, WiredTiger storage engine creates one file ...
1
vote
1answer
66 views

Is it possible to restore mongodb after db.dropDatabase() by replacing the contents of folder /data/db with older backup?

In order to reset replication, I did drop the local mongo database using the following commands: use local; db.dropDatabase(); The mongo data directory(dbPath) is /data/db/ I took a backup of this ...
0
votes
0answers
60 views

MongoDB Design - related tags

Given a tag, I want to know which are the most frequently used tags associated with that tag. The database has to be filled with an arrays of tags. The arrays of tags have average 20 elements. The ...
1
vote
1answer
285 views

How to correct Failed global > initialization: FileNotOpen

I am trying to run eos and using the std docs - https://developers.eos.io/eosio-nodeos/docs/build-validation I am trying - ~/opt/mongodb/bin/mongod -f ~/opt/mongodb/mongod.conf and I get the ...
0
votes
0answers
23 views

How to get distinct documents of user messages to different users?

In MongoDB we have distinct method that returns distinct values of a record from a specific collection: db.inbox.find({"inbox_type": "direct"}).distinct("sender") The above command returns distinct ...
0
votes
0answers
98 views

Force remove a dead shard from mongodb

I have a cluster with 3 shards, and one of them died. There is no backup of the shard and I can live without the data. I'm trying to remove the shard from the cluster and restart with the 2 remaining ...
0
votes
1answer
64 views

what if mongos server goes down in shard cluster setup

I have followed the tuturial Deploy a Sharded Cluster I have setup config server replica set with 3 members (cfg1, cfg2, cfg3) [replica set name = configserverreplica] mongodb server replica set ...
0
votes
0answers
11 views

MongoDB auto fail-over not working

I have three mongoD instances running in a replica set in windows. MD1 -> Primary, MD2-> Secondry, MD3-> Secondry settings.electionTimeoutMillis = 10 seconds. If I bring my primary MongoD instance ...
0
votes
1answer
205 views

How to query the mongoDB admin database?

I'm trying to execute the below commands taken from the mongoDB docs use admin db.system.version.find( { _id: "authSchema" }) But running those in Robo 3t gives the following output switched to db ...
-1
votes
1answer
1k views

Easiest Way to Migrate data from MySQL to MongoDB [closed]

My latest IT project has me working with MongoDB for the first time. While I have a bit (very little) experience with NoSQL, I have always mostly worked with MySQL using Workbench. I need to migrate ...
0
votes
2answers
81 views

sh.status() error processing query: ns=config.mongosTree

if I run sh.status in mongos I get the error: assert: command failed: { "ok" : 0, "errmsg" : "error processing query: ns=config.mongosTree: ping $gt new Date(1532712420740)\nSort: {}\...
1
vote
1answer
150 views

MongoDB sharding by monotonic id with zones for archiving

Situation: I have an ever-growing collection of documents which do have monotonically increasing unique id. All queries are direct lookup for documents with specified _id (no range queries nor ...