Questions tagged [mongodb]

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

Filter by
Sorted by
Tagged with
118 votes
4 answers
94k views

Difference between Sharding And Replication on MongoDB

I am just confused about how Sharding and Replication work. According to the definitions I found in the documentation: Replication: A replica set in MongoDB is a group of mongod processes that ...
user avatar
  • 1,301
82 votes
5 answers
43k views

Which database could handle storage of billions/trillions of records?

We are looking at developing a tool to capture and analyze netflow data, of which we gather tremendous amounts of. Each day we capture about ~1.4 billion flow records which would look like this in ...
user avatar
80 votes
4 answers
52k 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 ...
user avatar
  • 973
71 votes
5 answers
234k views

How restore a specific database from backup using mongorestore command

I created a backup of all my databases using mongodump command. Now I want to restore a specific database using mongorestore command. How is this possible, I use this command: --db option then ...
user avatar
45 votes
4 answers
37k views

Is it possible to install just the mongo Shell?

I have Docker installed and am running a MongoDB container for my local development on my Mac. The problem is that I can't connect to said DB easily from CLI. I have Robo 3T installed, but I would ...
user avatar
  • 553
44 votes
3 answers
85k views

MongoDB using too much memory

We've been using MongoDB for several weeks now, the overall trend that we've seen has been that mongodb is using way too much memory (much more than the whole size of its dataset + indexes). I've ...
user avatar
  • 871
38 votes
3 answers
45k views

check storage engine from shell

I'm upgrading to 3.0 and ran into some issues with the upgrade. Specifically, I got an error when trying to start up mongod via ssh, it tried to use the default dbpath instead of the one I specified ...
user avatar
  • 483
38 votes
4 answers
33k views

Difference between MongoDB's find and findone calls

I am working on a project and I am unsure if there is a difference between the way the find cursor works and the way the findOne cursor works. Is findOne just a wrapper for find().limit(1)? I was ...
user avatar
33 votes
5 answers
100k views

How can I enter Mongo as a superuser or reset users?

I'm was playing around with permissions and locked myself out of Mongo database. I'm pretty sure I did this by trying to explicitly add access to a database but instead I overwrote only allowing ...
user avatar
  • 539
33 votes
1 answer
58k views

Sample YAML Configuration Files for MongoDB?

The MongoDB configuration options documentation lists all the available options that can be specified, but does anyone have a set of fully formed example YAML formatted config files for MongoDB ...
user avatar
  • 9,075
32 votes
1 answer
24k views

Mongodb incremental backups

I was given the task to set up incremental backups for MongoDB replicaset, as start point, of course, I googled it and could not find anything on MongoDB docs, I did find however this question on ...
user avatar
  • 421
28 votes
2 answers
19k views

Using MongoDB and PostgreSQL together

My current project is essentially a run of the mill document management system. That said, there are some wrinkles (surprise, surprise). While some of the wrinkles are fairly specific to the project,...
user avatar
26 votes
3 answers
24k views

MongoDB MMAPv1 vs WiredTiger storage engines

In mongoDB3 appeared a new storage engine: WiredTiger. Yet, MMAPv1 is still the default choice in Mongo. One might not be better than the other, it's often a matter of use case and choosing the ...
user avatar
  • 365
26 votes
1 answer
23k views

What happens if there are too many inserts in MongoDB? How to ensure all data is stored?

I use MongoDB to store periodically measured values. Every ~100 ms a bunch of values is inserted as document. It works fine, but I'm worried about performance issues. (I use safe inserts, it seems as ...
user avatar
  • 363
23 votes
2 answers
132k views

Mongo Create a user as admin for any database raise an error

I am trying to create a simple user with the rights permission to access to any database and can do any actions. When I trying to execute the createUser command I got this error: db.createUser({ user:...
user avatar
  • 615
21 votes
3 answers
141k views

Date range query for past 24 hour in Mongo shell

I am setting a cron job to collect results from MongoDB database profiler. I'd like to collect results within a 24 hrs period. I plan to run mongo command with javascript. Question is, in Mongo shell,...
user avatar
21 votes
3 answers
45k views

MongoDB: RAM requirements

Is it enough to have the entire index in memory/ram or does mongodb even try to allocate as much ram as possible to store even the data for fast reads? I'd like to run mongodb + other applications ...
user avatar
  • 695
19 votes
2 answers
23k views

How to backup large MongoDB database

What is the recommended way to back up large data sets in MongoDB? Let's say we have a data size in the order of 10TB - how would you back that up? We're considering a hidden, possibly delayed, ...
user avatar
  • 293
19 votes
2 answers
12k views

How mongoDB projection affects performance?

From MongoDB documentation it is mentioned that: When you need only a subset of fields from documents, you can achieve better performance by returning only the fields you need How filtering ...
user avatar
  • 3,546
19 votes
2 answers
20k views

MongoDB terminates when it runs out of memory

I have the following configuration: a host machine that runs three docker containers: MongoDB Redis A program using the previous two containers to store data Both Redis and MongoDB are used to ...
user avatar
19 votes
2 answers
19k views

How do I determine why a MongoDB document is failing validation?

How do I determine why a MongoDB document insert is failing validation? All I get back is a writeError that says "Document failed validation", which isn't very helpful. (This happens often, and I'd ...
user avatar
19 votes
5 answers
7k views

Infrastructure for Highly Concurrent, High Write DB

My requirements are: 3000 Connections 70-85% Write vs Read Currently, we are maxing out a High-CPU, Extra Large Instance at 700 connections. All 8 cores are maxed. We think it's the number of ...
user avatar
  • 291
18 votes
2 answers
1k views

CouchDB vs MongoDB [closed]

Evaluating document-oriented storage, what are the pros and cons of CouchDB vs MongoDB?
user avatar
  • 875
16 votes
1 answer
5k views

How do databases store index key values (on-disk) for variable length fields?

Context This question pertains to the low-level implementation details of indexes in both SQL and NoSQL database systems. Actual structure of the index (B+ tree, hash, SSTable, etc.) is irrelevant as ...
user avatar
15 votes
4 answers
55k views

How restore from .gz backup with new database name using mongorestore r3.2.9?

I'm trying to backup/restore mongodb database to/from .gz files as sample script here #01 create .gz backup - ok for r3.2.9 and r3.4.10 mongodump --db ${DB_NAME} --gzip --archive=${BACKUP_FILE_GZ} #...
user avatar
  • 279
15 votes
3 answers
15k views

What is difference between mongodump and mongoexport?

I know that when we have to take full backup at database & collection level we use mongodump but with mongodump we can take backup of a particular record also so what is difference between ...
user avatar
  • 173
15 votes
2 answers
28k views

Mongo DB Replica set Stuck at RECOVERING state

We have created a replica set and now the problem is 2 members of replica set [3 members set] are in recovering mode from 48 hours. Initially the size of recovering nodes was increasing and now even ...
user avatar
14 votes
2 answers
43k views

How to specify authentication database and target database separately on mongodb connection uri?

I am using this connection uri to connect to mongodb: mongodb://user:password@localhost/admin. It will use admin as bot authentication and target database. How can I make the uri to use admin as ...
user avatar
14 votes
1 answer
10k views

what is "planSummary: IDHACK"?

This Query scans only one document and returns only one document. But this is very slow: 2017-05-22T07:13:24.548+0000 I COMMAND [conn40] query databasename.collectionname query: { _id: ObjectId('...
user avatar
  • 2,188
14 votes
6 answers
23k views

Why is Mongo stuck in STARTUP2?

I have a Mongo replica set with a few secondaries. A box, which hosts a secondary instance, crashed and lost the database. I started the secondary Mongo instance again and now it's stuck in STARTUP2 ...
user avatar
  • 263
13 votes
4 answers
747 views

Good Resources on Operating/Administering MongoDB

What are the best resources for learning how to operate and administer MongoDB? There are plenty of resources on developing against it - which actually creates a problem when you've got plenty of ...
user avatar
  • 233
13 votes
3 answers
19k views

How should I store time series in mongodb

I need to create a database of time series, and perform the following tasks: create new time series update existing time series query one or several time series at once (for instance all time series ...
user avatar
13 votes
2 answers
7k views

Sudden Mongodb high connections/queues, db stops responding

The issue We have a strange issue on our mongodb setup. Sometimes we get peaks of high connections and high queues and the mongodb process stops responding if we let the queues and connections ...
user avatar
  • 213
12 votes
2 answers
7k views

MongoDB: co-locate the mongos process on application servers

I would like to ask a question about a best practice described in this document: http://info.mongodb.com/rs/mongodb/images/MongoDB-Performance-Best-Practices.pdf Use multiple query routers. Use ...
user avatar
  • 173
12 votes
1 answer
8k views

Is XFS still the best choice for mongodb?

There is this guide for production servers: https://docs.mongodb.com/manual/administration/production-notes/#kernel-and-file-systems It tells that for the WiredTiger storage engine, XFS is strongly ...
user avatar
  • 393
12 votes
1 answer
13k views

MongoDB performance vs. PostgreSQL with 5.5 million rows / documents

Can someone help me compare these queries and explain why the PostgreSQL query executes in just under 2000ms and the MongoDB aggregate query takes almost 9000ms and sometimes as high as 130K ms? ...
user avatar
  • 121
12 votes
2 answers
966 views

Is sharding effective for small collections?

It looks like database sharding is great if I have huge collections. What if I have lots of fairly sized collections ? Let's say that for 1 collection of 100 000 000 documents (not very big comments) ...
user avatar
11 votes
1 answer
16k views

How do I (safely) kill long running operations in MongoDB?

Occasionally operations get out of control in MongoDB and might end up running for hundreds of seconds, and impact performance until they are killed or completed. When that happens, I know I have ...
user avatar
  • 9,075
11 votes
4 answers
37k views

Error parsing YAML config file: yaml-cpp

I'm using the following command (Windows machine) with the MongoDB shell version: 3.0.7: mongod --config "G:\NodeApps\mongod.cfg" --install Contents of mongod.cfg file are given below: systemLog: ...
user avatar
11 votes
3 answers
10k views

Upstart script in ubuntu for mongodb

I am new to linux and mongodb. I've already installed mongodb on ubuntu but I want to run one more instance on different port. As I understood from other questions and forums , there must be upstart ...
user avatar
  • 223
11 votes
2 answers
11k views

MongoDB Replica Set SECONDARY Stuck in `ROLLBACK` State

During a recent automated update of our mongodb PRIMARY, when the PRIMARY stepped down it permanently went into a ROLLBACK state. After several hours in the ROLLBACK state, there was still no ...
user avatar
  • 561
11 votes
1 answer
8k views

MongoDB Not Using All Available RAM

I have something around 200 GB worth data stored in a mongo cluster. The physical memory on one of the instances which runs mongo is 8GB. Nothing else of any consequence runs on this instance. As near ...
user avatar
  • 561
10 votes
4 answers
38k views

How can I update a single field in an array of embedded documents?

I would like to update a field in an array of embedded documents. My sample document is: db.students.insert( { first_name:'AA', last_name:'BB', cours_reussis:[{intitule:'...
user avatar
  • 113
10 votes
9 answers
71k views

MongoDB doesn't start after changing the data directory

I have installed a mongodb instance using yum.. Now everything works fine. I started the service using service mongod start. It works well. Then I changed the data directory and log path in the ...
user avatar
  • 220
10 votes
3 answers
5k views

Relational vs Non-Relational Database for Events Database

I'm trying to find out whether an SQL or no-SQL solution would be better for creating an events database. I'm creating a ticketing system, similar to ticket master. I know that for either database-...
user avatar
  • 203
10 votes
3 answers
15k views

How to restore .wt backup file to local MongoDB?

This is a question that was asked before, but I have tried all solutions, and simply cannot get it right. I have spent quite some time researching before posting this question. I have looked at the ...
user avatar
  • 133
10 votes
10 answers
30k views

mongodb could not find host matching read preference { mode: \"primary\" } for set?

I am deploy a monodb sharding, I have deploy a replica set in three machines: dev41:27017,dev42:27017,dev193:27017 and configsvr in three machine: dev41:27019,dev42:27019,dev193:27019 and also a ...
user avatar
  • 213
10 votes
2 answers
14k views

Mongo Collection `Size` is *larger* than `storageSize`?

I recently compacted my collection using the command: db.<collectionName>.runCommand( "compact" ) And now my collection size seems to be bigger than size on disk! SECONDARY> db.<...
user avatar
  • 561
10 votes
1 answer
26k views

Mongo cannot find my collection

My mongodb server has a database named villageContents It has a collection named tablebusiness If I run mongo I saw MongoDB shell version: 2.0.7 connecting to: test > I wonder what "test" is. ...
user avatar
  • 1,325
9 votes
2 answers
9k views

Mongodump affects app performance really bad

We have quite a big mongo instance (150 GB) with no sharding, and our regular backup (mongodump) has a very significant effect on the app performance. Worse than that, due to the heavy use of mongo by ...
user avatar

1
2 3 4 5
47