The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [mongodb]

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

Filter by
Sorted by
Tagged with
8
votes
4answers
371 views

How to handle queries of 500M+ items

The structure of my data is the following: date: <timestamp> filter_a: <integer> -> range [0, 1000] filter_b: <integer> -> range [0, 1000] filter_c: <integer> -> ...
8
votes
1answer
4k 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 ...
7
votes
2answers
7k views

Large `mongodump` followed by `mongorestore`

I have a fairly large (~240GB) Mongo database that I need to transfer across a sluggish network and onto a new server. Traditionally for these situations, I've found that a mongodump followed by a ...
7
votes
3answers
23k 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:'...
7
votes
2answers
3k views

MongoDB vs RDBMS DBA duties

What are the differences between the daily tasks/duties of a Mongo DBA compared to a RDBMS DBA? For example, some sites claim that a MongoDB DBA would not require to do data modelling or designing ...
7
votes
1answer
8k views

Difference between mongod and mongodb upstart jobs

I just noticed that there are two possible ways to start mongodb: service mongodb start (uses /etc/mongod.conf) service mongod start (uses /etc/mongodb.conf) Can someone tell me what's the ...
7
votes
1answer
11k 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) ...
7
votes
1answer
4k views

How are Mongodb indexes stored on disk?

So let me first start the question with my understanding of how MongoDb stores data on disk: So when you create a database in mongodb, it allocates a large file named <databasename>.0 and within ...
7
votes
1answer
2k 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 ...
7
votes
1answer
3k 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 ...
7
votes
1answer
1k 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: ...
7
votes
1answer
2k views

high background flush avg mongodb

similar question: High Global Lock % on Mongodb Overview We have a production setup replica set in v2.4.8 mongodb running on five 4-core, 28gb RAM VMs with standard azure datadisk HDDs running on ...
7
votes
1answer
2k 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: ...
7
votes
2answers
331 views

Mongos not returning existing data in shards

So we have a configuration of 2 shard (each is a replica set) and one sharded collection. There are around 10 million records in each shard. We are using mongo 2.6.4 version. We have sharded with ...
7
votes
2answers
3k views

verify that mongos server is connected to config servers

I've been writing a backup script for sharded replica-sets and it's almost done, except that I can't seem to get it to successfully start the balancer back up after everything's all said and done. ...
6
votes
2answers
5k views

MongoDB - Should I separate the journal and the data to different drives?

I have seen and heard from multiple sources that it can be a good idea, performance-wise, to write your db journal and your data files to separate disks. What's the recommended way to do this (e.g. ...
6
votes
3answers
3k 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-...
6
votes
1answer
6k views

MongoDB Manual References vs DBREF

I've been researching MongoDB and trying to see if it would be a fit for my company's product catalog. I came across database references: http://docs.mongodb.org/manual/reference/database-references/ ...
6
votes
1answer
5k views

Can I disable journalling to improve performance

We have a 16 shard MongoDB 2.4 installation running in AWS that is eating money. The data is volatile, it only gets used within 15 minutes of creation If the cluster goes down we wipe it out and ...
6
votes
2answers
5k views

Should I index before or after importing a dump?

I am using mongodb to persist a very big-size (90G), which has nearly 40,000,000 items. I read and parse this file and insert all items into mongodb (my programming language is perl, batch_insert, and ...
6
votes
2answers
3k views

Force a Member to Become Primary in mongodb

I looked into answers but nothing works for me in mongo 2.6.11 cluster 'nms' (members nms01m and nms02) below. I want my current secondary nms01m to become primary, and now nms02 is primary instead of ...
6
votes
4answers
8k views

Secondary and Arbiter stuck in Startup

I'm using MongoDB version 3.0.0. I'm trying to setup mongodb replication on our machine. Replication was initially setup but due to some changes on the VM the entire thing crashed. When I tried to set ...
6
votes
1answer
4k views

MongoDB 3.0 : Configure storage engine at collection or database level

I know we can configure the storage engine to be wiredTiger at instance level when we start mongod. But can we also select the storage engine to be different for different collection or database?
6
votes
1answer
9k views

How to create an efficient, scalable, multi-tenant data layer using MongoDB? [closed]

I'm working on the architecture for my upcoming Project Mangement app (as an example) and I'm seeking clarity on how best to design the MongoDB data layer, with specific regard to multi-tenancy. The ...
6
votes
3answers
8k views

Primary replica set server goes secondary after secondary fails

I have a 2 servers replica set that, after the secondary fails the primary goes into secondary mode while the secondary is in STARTUP2 (recovering). The problem with this is that I can't use the ...
6
votes
1answer
765 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
3answers
2k 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 ...
6
votes
1answer
6k views

How we can take backup oplog on every hour and apply on top on full backup for mongodb

We have full lvm snapshot backup. We are trying to take oplog backup in every hour and save as a file. We like to apply the oplog backup on top of full backup if we need to. We like to know how we can ...
6
votes
1answer
14k views

mongodb: drop all collections

How to remove existing content before entering a replicaset the first time? mongodb worries about: ... has data already, cannot initiate set. All members except initiator must be empty.
6
votes
1answer
1k 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
2k 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 ...
6
votes
1answer
3k 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? How ...
6
votes
1answer
755 views

Remove a shard in MongoDB

I have a MongoDB cluster, I accidentally hosed a shard, I don't have a backup. It's pretty easy to recover the data, but after issuing the removeShard command, it says it's draining. However, the ...
6
votes
2answers
269 views

3 Node Replica Set all became SECONDARY

My 3 set replica set all became secondary and I'm not sure why. The logging I got was: db1 2014-12-12T02:43:55.067+0000 [conn1413096] end connection 10.0.64.12:58483 (512 connections now open) ...
5
votes
3answers
16k 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} #...
5
votes
4answers
950 views

Mongodb authentication database best practice

In mongodb you can store user credentials in different databases. E.g. Say you have a products db, you could store the user products_worker in either database admin or products. Is there a best ...
5
votes
6answers
1k views

Lots of Indexes - MySQL vs MongoDB - Migrating

So, I've never used MongoDB, I just read a lot about it and I think it's going to be good for my project. Also, I do not have lots of experience with MySQL and to be even more honest I have no clue of ...
5
votes
3answers
6k 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 ...
5
votes
2answers
2k 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
6k views

Mongo authentication user can't drop database

my question is - is it possible to define user in the Mongo database who will be able to drop the database? Maximum user privilege is "dbAdmin" but that privilege doesn't allow users to drop the ...
5
votes
2answers
3k 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, ...
5
votes
3answers
8k 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 ...
5
votes
2answers
11k views

Upgrade mongodb from 2.4 to 3.0

I have mongodb 2.4 database with some indexing. Now I want to upgrade that version to 3.0. I searched on google but did not find any firm answer. I tried installing 3.0 but then it gives me error of ...
5
votes
2answers
3k views

Mongodb restrict access on collections level

I'm building a backend system using MongoDB. Now I want to restrict access on certain numbers of database collections to this system. For example I have users, admin_users, pageviews and I want this ...
5
votes
2answers
14k views

Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:91 when changing mongodb data directory

I already change the owner of the directory I want to use root@ip-10-138-30-205:/media/newdrive# ls -l ...
5
votes
1answer
9k views

Mongodb: Document size of 29344731 is larger than maximum of 16777216

When we are upgrading AEM 6.1 instance with mongo (Mongo version: 2.6 ) to AEM 6.3 with mongo (Mongo version: 3.2) we are facing the exception. org.apache.jackrabbit.oak.plugins.document....
5
votes
1answer
2k views

MongoDB replication: going into maintenance mode with 10333 other maintenance mode tasks in progress

I have a MongoDB instance where resync is required. 2016-11-07T11:59:23.330+0000 I REPL [ReplicationExecutor] syncing from: x.x.x.x:27017 2016-11-07T11:59:23.354+0000 W REPL [rsBackgroundSync]...
5
votes
3answers
8k views

'mongod wiredTiger' on Ubuntu?

I cannot use wiredTiger as a service for MongoDB. I followed this step by step guide; http://docs.mongodb.org/manual/release-notes/3.0-upgrade/ Step-1: Start 3.0 mongod.OK, I did. Step-2: Export ...
5
votes
4answers
12k views

Limit the RAM memory usage in MongoDB

I am using MongoDB-2.6.1. Is there any way to limit the RAM memory usage? For example: Out of 4 GB RAM, let MongoDB use till 3 GB (<= 3 GB).
5
votes
1answer
1k views

MongoDB presplitting chunks for compound shard key

In my mongodb setup I have a compound shard key {"region" : 1, "foo" : 1, "bar" : 1} and I know the values region can be and that each region should be on one chunk. Therefore I'd like to pre-split ...