Questions tagged [mongodb]

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

Filter by
Sorted by
Tagged with
3
votes
1answer
7k views

How to set a mongodb node to return as the primary of a replication set?

There is this question here: How to force a mongod to become primary in a replica set? But it was not the answer I was looking for. and there is the question below, which could be related but it is ...
3
votes
1answer
4k views

How unique are MongoDB _id fields?

I am trying to create a schema for documents and collections for a MongoDB database I am creating. I have read a few documents describing the _id field that is generated by each document upon creation....
3
votes
1answer
2k views

How do long string field names affect MongoDB database size?

I am using MongoDB and the names of my fields are strings with 10-20 characters. A typical document consists of 30.000 columns filled mostly with floats, like 1.2, 10.5, 2.55. It's size is 1MB. Do ...
3
votes
1answer
4k views

Query MongoDB Collection Compression Settings?

How can i query the settings for collection compression in MongoDB? I configured WiredTiger as storage engine and as collection compression the zlib algorithm. Here is a snippet of my configuration ...
3
votes
1answer
8k views

Mongodb update conditional set operator ($set only when it is insert )

Is there anything in Mongo update where $set when will work only when an insert is done. example is I have a collection which has these fields: Username FirstOccurrence Count What i want that i ...
3
votes
2answers
3k views

Why does mongodb require three config servers

The official mongodb documentation states to use three config servers. They say its for redudancy, because 1 server would be a point of failure.... but why not 2? in a production sharded cluster, if I ...
3
votes
2answers
609 views

Does MongoDB auto compacting

I copy a collection to another collection. Data is 14GB. I deleted the copied collection. Yet the size of the directory is still 14 GB. I chose repair but it seems to take forever. Actually inserting ...
3
votes
2answers
547 views

How to check the pre-allocated database file of MongoDB is Used or not?

We have been using MongoDB for a few weeks. One thing we could not understood is Pre-allocated file. Is there any way to check whether the pre-allocated file is currently used by MongoDB or not? We ...
3
votes
3answers
5k views

mongorestore Too many open files

When I run mongorestore I get error running create command: 24: Too many open files. I've updated my launchctl limit and ulimit. When I run lanchctl limit I get: cpu unlimited ...
3
votes
1answer
4k views

MongoDB replica set - Error in heartbeat request

I have created mongo db replica set in my local as below: mongod --port 27021 --dbpath /cm1/mongodb/rs0-1 --replSet rs0 --smallfiles --oplogSize 128. I have started all 3 (1 Primary, 2 ...
3
votes
1answer
83 views

Does it make sense to limit Mongo RAM?

I have a Windows server running MongoDB. My database has big indexes and all RAM is usually busy. As I know, it can be a cause of Windows swapping and performance issues. Does it make sense to limit ...
3
votes
2answers
4k views

When is the _id index used?

When is the _id index used by MongoDB? I could not find anything specific about it in Index Introduction, Analyze Query Performance, and Query Plans. When sorting by _id at the end of the query via ....
3
votes
2answers
4k views

How to find queries that timed out in MongoDB?

Is it possible to find queries in the system.profile-Collection of a MongoDB-database that did not finish due to a timeout? I found some queries that ran longer than the time specified in $maxTimeMS. ...
3
votes
1answer
7k views

mongodb is using most of disk space for journal and not cleaning itself

I am using mongodb on production with journal enabled. I am using mongodb to store application data and also using gridfs to store images. I am using Elastic Block Storage (EBS) with 10GB for each ...
3
votes
1answer
1k views

how to make secondary slave as readable in MongoDB?

How do I make a secondary slave as readable in MongoDB? We can do this via shell command rs.slaveOk() But how we can do it permanently for all session via config file?
3
votes
1answer
194 views

Setup MongoDB replica servers with different power?

Is it a good practice to setup replicas with the same machine size (wrt. CPUs, RAM, Bandwidth, etc.) or can replicas be based on smaller machines? One usecase might be to have a small non-voting ...
3
votes
2answers
5k views

How to add setParameter in mongod config?

When I am using setParameter in mongod config, I start mongod with error: Unrecognized option: setParameter = enableLocalhostAuthBypass=1 How can I use setParameter from config file ? P/S: I am ...
3
votes
1answer
3k views

errno 98 but no other mongod running

Here are my config options: options: { config: "/etc/mongod.conf" , net: { bindIp: "127.0.0.1, 10.0.2.57" } , processManagement: { fork: true, pidFilePath: "/var/run/mongodb/mongod.pid" } , storage: {...
3
votes
2answers
9k views

How to activate shard balancer in sharded MongoDB

I have a very simple MongoDB database structure. Also I have 5 shards in it (3 of them are replicasets). But we are testing DB loading and it seems that shard balancing isn't currently enabled. On ...
3
votes
2answers
1k views

Is it safe to remove an entry in a “config.mongos” MongoDB collection?

There are old entries in my "config.mongos"; they reference hosts which previously had "mongos" running on them but no longer do. Can I safely remove those entries? e.g.,: # Old entries { "_id" : "...
3
votes
2answers
2k views

collection partitioning in mongodb

Is there any semantic like table partitioning in MongoDB? My data is not that much that it would need sharding. but data is not important(but not completely useless) after several months.
3
votes
2answers
193 views

What are the best Database Analytics Companies for analyzing several 1000s or Mio. of products,sum them together and analyze them for statistics?

We will get several thousands products in our database. The problem is that one product can have several different names e.g. "iPad 16GByte UMTS schwarz" or "iPad 16GB 3G black" and so on. But they ...
3
votes
1answer
382 views

MongoDB in ReplicaSet databases showing different sizes and objects

I have a MongoDB in a ReplicaSet with 3 members, and last week the primary node got corrupted somehow and stopped. I had to resync the data from the other nodes. It has been a week but I was checking ...
3
votes
1answer
5k views

MongoDB Maxing CPU Usage

I have a weird one here. We have set up our production MongoDB which was populated by our test one so we had something to work off of. As soon as we started the service we hit instant 100% CPU load ...
3
votes
1answer
2k views

How to match a WiredTiger index file to its corresponding collection

I have a mongodb database with about 2 billion records, shared between 20 or so collections. Each of these collections has an index on it, based on a single key (other than _id). I have an index file ...
3
votes
2answers
2k views

what is an Assert in Database world?

I searched for Assert and found general explanations: Assertion (software development) In computer programming, an assertion is a statement that a predicate (Boolean-valued function, a true–...
3
votes
1answer
547 views

MongoDB Restore / Snapshot Schedule - Point In Time vs. Oplog Timestamp

in docs Restore a Replica Set from a Backup those restore points are available: Snapshot Point In Time Oplog Timestamp What's the differences between those restore points? I guess Snapshot is fast ...
3
votes
2answers
1k views

MongoDB replica set node failure without arbiter

I'm baffled by the fact that this isn't addressed in the official docs (or at my inability to track it down). From the 3.4 docs: Only add an arbiter to sets with even numbers of voting members. If ...
3
votes
2answers
7k views

MongoDB - Unable to change mongodb storage engine to WiredTiger

I have installed MongoDB in Ubuntu 14.04 but I am unable to change its storage engine to WiredTiger. I have added the necessary changes to the /etc/mongod.conf file which is namely as the following-: ...
3
votes
1answer
108 views

MongoDB mongos router and microservices architecture

Any mongos process in your infrastructure can perform chunks migration while they hold the lock. In a microservice architecture, processes are started and stopped more dynamically, i'm thinking for ...
3
votes
1answer
145 views

How do I know that I am connected to a config server

I need a simple check for identifying that I am connected to a MongoDB config server. I can check the process to differentiate between mongod and mongos: > db.serverStatus().process; mongod Now ...
3
votes
1answer
2k views

Mongo Scaling - Too Many Connections - Linear Horizontal Scaling with 100s of App Servers

I have a Mongo Cluster. It's sharded on 6 servers, with 6 replica sets, each replica set having one Primary, and two Secondaries. Additionally, there are 3 config servers. Though, I think the Mongo ...
3
votes
1answer
11k views

What's the procedure to set up username/password on mongodb?

I have tried setting up username / password .But none of the methods seems to work. 1. In mongod.conf ----> remove **#auth=true** to **auth =true** 2.Started the mongod server --> sudo service ...
3
votes
1answer
9k views

Searching for array elements nested in MongoDB Documents

I need to store card documents in my database. Cards need to be stored with a set of integers that represent the bundle, box and pallet, or whatever other entity they belong to. The packaging ...
3
votes
1answer
2k views

MongoDB ReplicaSet reconfig when primary and majority don't exist

http://docs.mongodb.org/manual/tutorial/reconfigure-replica-set-with-unavailable-members/ Is there anyway to reconfigure a replica set in the event the primary as well as a majority of the servers ...
3
votes
1answer
3k views

mongodb: maxTimeMS ignored

After trying with different drivers and clients, we suffer with mongodb timeout on find query. Even Profiling logs the settings and issue well. 2014-08-13T23:46:43.218+0200 [conn80] query ...
3
votes
1answer
8k views

MongoDB insert performance rapidly dropping

I'm currently experiencing a rapid decrease of the insert Performance. I have a rather simple data model { "Id": "ObjectId", "SomeProp": "xy", "SomeTags": [ { "key": "...
3
votes
1answer
366 views

Accessing unsharded database in a MongoDB shard cluster without going through mongos?

As far as I can understand, not all databases in a MongoDB shard cluster have to be sharded; I can keep some databases unsharded, on only one of the shards. So suppose I have a shard cluster, with ...
3
votes
1answer
422 views

Does mongodb automatically move small non-partitoned databases to spread read load?

I have a few hundred small databases, each between 0.2GB and 4.0GB in size. These are sitting on a sharded mongodb environment with 10 or so shards. At any one time, only a very small subset of these ...
3
votes
1answer
165 views

MongoDB: Should I combine fields for performance in limited circumstances

I have a really simple MongoDB collection: { "user": 1, "domain": "example.com", "apiAccess": true } There's an index on the "user" and "domain" fields. I always perform the same type of query ...
3
votes
1answer
1k 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 ...
3
votes
1answer
872 views

MongoDB Connectivity Issue

From last few days, I am facing connectivity issues with MongoDB Replica Sets deployed in google cloud. Interesting fact is these issues are appeared at Development machines and not on the production. ...
3
votes
1answer
427 views

MongoDB: is order guaranteed deep into the aggregation pipeline?

I'm trying to get the "top" 2 items for any number of foreign keys, sorted by some key. What I have is the following, which appears to work: db.getCollection('col1').aggregate([ {$match: {fk: {$...
3
votes
2answers
1k views

How to add userAdmin user in Mongodb Atlas

How to add a user with userAdmin role in Atlas? The Cluster Security "Add New User" UI https://cloud.mongodb.com/v2/.....#clusters/security/users shows only limited set of built-in roles without any ...
3
votes
2answers
7k views

How to set up a user who doesn't have `admin` database access but use it as authentication database?

I want to setup a user in MongoDB. This user will not have admin database access. But it uses admin as authentication database. It will fail to connect the mongoDB by this command mongo --host ...
3
votes
2answers
5k views

Creating mongodb database with ansible playbook

How i can create MongoDB database with Ansible? is it possible? If not, can i do this with bash script? I tried to use mongodb_user module for Ansible, but it cant work without existing table.
3
votes
1answer
654 views

Using Mysql and MongoDB together

I currently have all of my data in a MySQL database which handles my entire application system. My current setup is a Java desktop application that publishes data to the database through a NodeJS API. ...
3
votes
1answer
999 views

Mongodb Replica Member Server Changed: Status Stuck In STARTUP. Missing config

I am on mongo v3.0.x and have a replication set with 3 members, but the second member (and entire server) was unexpectedly taken down and destroyed. I have stood up a new server to use as a ...
3
votes
1answer
524 views

cleaning up failed repair db: path: /var/lib/docker/wesfgr/repair/_tmp_repairDatabase_0

We run MongoDB 3.0.6 with MMAP in Docker container (single node). The filesystem was full and I did a repair with other path. 2016-10-03T08:58:51.186+0200 I INDEX [initandlisten] building ...
3
votes
1answer
498 views

use cases for db.collection.validate() - checks the structures within a namespace for correctness by scanning the collection’s data and indexes

I found on MongoDB mailing list one use case for db.collection.validate(): The count() command is generally an estimate of the current document count, based upon statistics provided by the ...