Questions tagged [mongodb]

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

Filter by
Sorted by
Tagged with
127 votes
4 answers
107k 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 ...
Saad Saadi's user avatar
  • 1,401
85 votes
4 answers
59k 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 ...
Dave's user avatar
  • 1,023
85 votes
5 answers
48k 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 ...
somecallmemike's user avatar
71 votes
6 answers
243k 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 ...
pankaj choudhary's user avatar
49 votes
3 answers
103k 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 ...
SpiXel's user avatar
  • 1,001
45 votes
4 answers
40k 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 ...
CodeChimp's user avatar
  • 553
40 votes
3 answers
48k 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
39 votes
4 answers
34k 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 ...
WojonsTech's user avatar
37 votes
6 answers
108k 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 ...
Tony's user avatar
  • 579
34 votes
1 answer
28k 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 ...
Tiago's user avatar
  • 441
33 votes
1 answer
60k 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 ...
Adam C's user avatar
  • 9,235
31 votes
2 answers
22k 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,...
chucksmash's user avatar
28 votes
2 answers
167k 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:...
Robert's user avatar
  • 695
27 votes
1 answer
24k 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 ...
lumbric's user avatar
  • 373
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 ...
Buzut's user avatar
  • 365
23 votes
3 answers
147k 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,...
Howard Lee's user avatar
  • 1,019
21 votes
3 answers
47k 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 ...
ledy's user avatar
  • 695
20 votes
2 answers
25k 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, ...
Malakim's user avatar
  • 303
20 votes
2 answers
25k 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 ...
Simone Bronzini's user avatar
20 votes
2 answers
23k 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 ...
Jonathan Wheeler's user avatar
20 votes
5 answers
8k 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 ...
Justin's user avatar
  • 301
19 votes
2 answers
17k 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 ...
Alireza's user avatar
  • 3,636
19 votes
1 answer
15k 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('...
Sybil's user avatar
  • 2,498
18 votes
2 answers
2k views

CouchDB vs MongoDB [closed]

Evaluating document-oriented storage, what are the pros and cons of CouchDB vs MongoDB?
Abie's user avatar
  • 885
17 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 ...
Riyad Kalla's user avatar
16 votes
6 answers
71k 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} #...
Nam G VU's user avatar
  • 289
16 votes
2 answers
51k 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 ...
Joey Yi Zhao's user avatar
16 votes
2 answers
32k 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 ...
Avinash Sahu's user avatar
15 votes
3 answers
18k 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 ...
yogesh.j's user avatar
  • 173
15 votes
6 answers
27k 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 ...
Michael's user avatar
  • 273
15 votes
3 answers
27k 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 ...
Saketh's user avatar
  • 193
13 votes
1 answer
40k views

node is not in primary or recovering state

My config file is: systemLog: destination: file logAppend: true path: c:\data\log\mongod.log storage: dbPath: c:\data\db journal: enabled: true replication: replSetName:...
invzbl3's user avatar
  • 277
13 votes
4 answers
751 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 ...
Rex M's user avatar
  • 233
13 votes
1 answer
10k 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 ...
nagylzs's user avatar
  • 411
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 ...
RockScience's user avatar
13 votes
2 answers
8k 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 ...
clopez's user avatar
  • 213
12 votes
1 answer
13k views

Why mongo is choosing the wrong index / execution plan?

In production mongod logfile, we can see a lot of slow queries. Most of them are not using the best index and consequently the best execution plan is not used. However, when I run the same queries by ...
Sy10100's user avatar
  • 335
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 ...
tenshi's user avatar
  • 173
12 votes
1 answer
14k 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? ...
Mike A's user avatar
  • 121
12 votes
2 answers
1k 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) ...
João Pinto Jerónimo's user avatar
12 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 ...
Chris W.'s user avatar
  • 591
11 votes
1 answer
18k 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 ...
Adam C's user avatar
  • 9,235
11 votes
4 answers
31k views

How to keep Mongodb log small via the conf file (or other persistent method)

This is related to my question in stackoverflow where vb.net simply hang on updating a mongodb query. https://stackoverflow.com/questions/12780258/insert-mongodb-using-vb-net/12796593#12796593 After ...
user4951's user avatar
  • 1,365
11 votes
4 answers
43k 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: ...
Raj Wadhwa's user avatar
11 votes
3 answers
12k 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 ...
Wylliam Judd's 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 ...
Erhan A's user avatar
  • 223
11 votes
2 answers
13k 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 ...
Chris W.'s user avatar
  • 591
11 votes
2 answers
16k 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.<...
Chris W.'s user avatar
  • 591
10 votes
2 answers
11k 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 ...
Alexander Mikhalchenko's user avatar
10 votes
4 answers
39k 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:'...
zouhair's user avatar
  • 113

1
2 3 4 5
49