MongoDB is a scalable, high-performance, open source, document-oriented database. It supports a large number of languages and application development platforms. Questions about programming should be asked on http://stackoverflow.com.

learn more… | top users | synonyms

35
votes
5answers
7k 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 ...
17
votes
2answers
1k views

CouchDB vs MongoDB [closed]

Evaluating document-oriented storage, what are the pros and cons of CouchDB vs MongoDB?
11
votes
2answers
4k 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 ...
11
votes
5answers
1k 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 ...
10
votes
4answers
548 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 ...
10
votes
2answers
449 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) ...
10
votes
1answer
4k 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 ...
10
votes
1answer
2k 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 ...
8
votes
3answers
4k 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 ...
8
votes
1answer
4k 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 ...
8
votes
2answers
2k 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 ...
7
votes
2answers
2k views

mongodb: replica-set with load balancer

Is there an option for load balancing with mongodb replica sets? I am not asking for a HAProxy or similar, but for a built-in feature from mongodb. Could not find tips for this in the docs.
7
votes
1answer
801 views

Mongo Map-Reduce or Sharding?

So I asked this question: Setting up Mongo with clustering But I didn't know enough until I read the answers and did more research. Is it better to use Map-reduce or sharding for fast-paced ...
6
votes
2answers
5k 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 ...
6
votes
2answers
309 views

Is there any way to efficiently perform the equivalent of DENSE_RANK in MongoDB?

SQL Server and Oracle both have DENSE_RANK functions. Is there a way to do something similar in MongoDB without having to resort to MapReduce? In other words, suppose you have a T-SQL select clause ...
6
votes
1answer
3k views

mongodb config servers not in sync

I have setup with 2 shards, with 2 replica servers and 3 config servers, and 2 mongos. I have following problems: 1) mongo config servers out of sync: Aug 14 09:46:48 server mongos.27017[10143]: Sun ...
6
votes
1answer
2k 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. ...
6
votes
1answer
263 views

Are shards distributed randomly across machines in MongoDB or are they in order?

Are shards distributed randomly across machines in MongoDB or are they in order? For example, if I had a MongoDB cluster that was sharded across two machines and my shard key was a person's name, ...
6
votes
2answers
5k 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 ...
6
votes
1answer
440 views

what is mongodb telling me when it logs an update?

After several minutes of a large program that pushes a lot of data into mongo, my log starts to show a message for (I guess) each update. This seems awfully noisy, is there some special reason it ...
6
votes
1answer
5k 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? ...
6
votes
1answer
2k 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 ...
6
votes
1answer
1k views

What factors contribute to lock-percentage with MongoDB

We're attempting to better optimize how we're using our MongoDB instance. We seem to be routinely getting high lock-percentages, and are looking to help minimize that. Here is some mongostat output: ...
5
votes
1answer
4k views

Mongodb - Returning the points nearest to a location, with distance

What is the MongoDB's equivalent to this query: SELECT 111151.29341326 * SQRT( pow(-6.186753-`Latitude`, 2) + pow(106.772835-`Longitude`, 2) ...
5
votes
1answer
32 views

Mongodb - see when a database was dropped

I want to know if there is a way to see when a database was dropped. Is there an entry in a log file or some other way to see when this occurred
5
votes
3answers
1k views

Setting up Mongo with clustering

I'm going to start using Mongo as a database but I will not have it clustered at first. Can I use Mongo on a single machine, then later come back, cluster it and capitalize on the sharding? Or can I ...
5
votes
1answer
338 views

MongoDB deployment best practices

I had a few questions around deployment best practices and how folks are using mongodb today. Feel free to add any other comments you can think off. No of databases per mongod instance. Is the ...
5
votes
1answer
1k 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> ...
5
votes
1answer
370 views

How to store and query products the price of which depends on a complex set of conditions?

I haven't decided on a database. I have expirience with MySQl and I'm intrigued by MongoDB. Let the products be packages of cable tv providers: { name: "Virgin TV", price: 20 }, { name: ...
5
votes
1answer
328 views

Overview of how MongoDB uses its various threads

On one instance I have MongoDB using ~85 threads. In lieu of having time to investigate directly, I am curious: What are the threads used for? Do they fall into a few high-level usage categories? ...
5
votes
1answer
193 views

Management tool for managing MongoDB sharded cluster

Is there a database management software for MongoDB that makes it easy to create a cluster, add shards, backup shards and all the complicated stuff. There are some many MongoDB clients but they are ...
5
votes
1answer
615 views

In MongoDB, is having lots of small collections better than having one huge collection?

Huge collections have huge indexes that may not fit into RAM. Is that problem entirely solved with sharding ? If I have lots of small collections with small indexes, what are the options for storing ...
4
votes
2answers
6k views

How can I time-stamp data in MongoDB?

I'm responsible for writing an app to juggle a huge amount of client and business intelligence information. This information involves records for various businesses and metrics like revenue, their web ...
4
votes
1answer
402 views

Would appreciate some suggestions on how I should model this data

I am setting up a website that will have users. Users can search for songs and (if signed in) save them to a playlist or their library of songs. I want it to be like iTunes in that all the songs on ...
4
votes
2answers
795 views

Sharded key-value store using MongoDB

Would like to set up a key-value store that is sharded across multiple machines. We are currently using MongoDB, is there a reason why we shouldn't use MongoDB for this purpose? We also use Redis, ...
4
votes
2answers
959 views

MongoDB: Replica Set - master vs. slave

We think about moving from a master-slaves to mongodb with replica-set. Now I wonder if mongodb replicas are also set up like read-only slaves or if each mongos is able to write and sync the others ...
4
votes
1answer
305 views

Should I deploy Mongodb sharding for 50 collections?

I have a 10 node clusters that runs about 50 concurrent jobs. Each job needs to read/write a separate collection. So I have about 50 collections roughly. Each collection has about 20 M records. Most ...
4
votes
1answer
345 views

Ideal environment and cost for running a medium size MongoDb server

I know some people will say this question does not belong here but i didnt find a better place on the internet to ask this. Please migrate to an appropriate place if you think it should be. I am using ...
4
votes
1answer
625 views

MongoDB optimization on high data

I have a mongoDB collection with 42M registers with 1M new registers every day. We found a low performance on mongoDB querying. showing in mongostat the fields: qr|qw ar|aw with values of 300-500. ...
4
votes
1answer
483 views

MongoDB problems recovering a member of the replica set

I have a sharded database with 2 replica sets (RS1 and RS2) each one of the RSs with 2 servers. I had a problem yesterday with one member of the RS2, the mongod instance crashed throwing an error. ...
4
votes
1answer
399 views

MongoDB working set size on capped collection larger than capped collection size?

On my database server right now I have 16GB of ram and an 8GB capped collection with about 4GB of indexes. So I may understand this wrong but shouldn't this only ever use around 12GB of my RAM or ...
4
votes
1answer
704 views

Design the big data with mongo db

I'm working now on the implementation of the following feature: Say I have a collection in mongodb with millions of entries (very big say 100M), each entry is of type {"uniqId", "properties"} for ...
4
votes
1answer
997 views

How to index dynamic attributes in MongoDB

I have following kind of data (simplified a bit from my real case) in MongoDB: { "name":"some name", "attrs":[ {"n":"subject","v":"Some subject"}, {"n":"description","v":"Some ...
3
votes
2answers
816 views

How to Determine Chunk Distribution (data and number of docs) in a Sharded MongoDB Cluster?

Having done all the right things - picked an appropriate shard key, scaled horizontally, distributed my data across several shards, I find I now have no real way to determine how well balanced the ...
3
votes
2answers
180 views

Scalability: Desiging a message table

This question might be deadly simple but I wanted to make sure I am going through the correct path and not making any simple and irrevertible mistakes. My project will be based on messaging and it ...
3
votes
3answers
686 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 ...
3
votes
2answers
256 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
942 views

mongoDB rs.initiate hangs

I am having trouble setting up replication on a new mongoDB installation. Everything works fine when I run without replication but when I run mongod with the --replSet option, and run rs.initiate(), ...
3
votes
3answers
802 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 ...
3
votes
1answer
2k views

MongoDB: What does '[DataFileSync] flushing mmaps took … ms for … files' mean?

I am building an index in MongoDB for a large collections (~300GB) and the db terminal window keeps printing: [DataFileSync] flushing mmaps took 10920ms for 151 files The time that it takes to ...