Questions tagged [mongodb]

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

Filter by
Sorted by
Tagged with
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
13k 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 ...
5
votes
2answers
5k 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 flush ...
5
votes
3answers
18k views

MongoDB — Failed global initialization: Failed to open “/var/log/mongodb/mongod-config.log”

I'm trying to setup the config servers for mongodb sharding. I created a specific config file that is set to log to /var/log/mongodb/mongod-config.log. When I run mongod --config <path-to-config-...
5
votes
1answer
450 views

Compound Indexes for different sorts

I'm searching on a field and I want to sort on 3 different fields (viewcount,rating,time) separately. Am I correct in assuming that I need to do three different compound indexes {searchField :1, ...
5
votes
1answer
1k views

MongoDB performance limits of mongo

There are 100 data files, each with 60 fields and over 4 million records. There is a perl program that inserts the records or updates them based on an userdefined _id field. There is also a History ...
5
votes
1answer
953 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
11k views

How can I load csv data into mongodb and choose the types I'd like to have created for each column?

I'm looking for a method to load csv data in mongodb and specify the types that I'd like to have created for each column? I've been using mongoimport but I find it quite painful because there doesn't ...
5
votes
1answer
696 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 ...
5
votes
1answer
287 views

MongoDB Migrating away from RocksDB to WiredTiger

We have been working for some time with RocksDB as our engine and we are now trying to migrate to WiredTiger. We have some pretty big databases around 4~12 TB of data and according to the process ...
5
votes
1answer
109 views

Mongodb get Effective Lock

I´m trying to calculate the Effective Lock %, like MMS does. I think I could get it via MMS API, but most of our mongo instances currently are not monitored in MMS (and probably never will). All I ...
5
votes
2answers
7k views

Who can explain mongodb with ssl?

I created certificates according to the instructions on the official website of MongoDB, but it doesn't work properly. I have a replica set and self-signed certificates. I need a full encryption ...
5
votes
1answer
2k views

mongoexport not exporting all possible data

I have a collection with documents similar to the following: { _id: 'p_123456', id: 123456, kind: 'person' data: [...] } id field can contain either positive or negative integers. This ...
5
votes
2answers
271 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
1answer
742 views

Management tool for managing MongoDB sharded cluster [closed]

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
1k views

MongoDB - slow remove query

I have a collection in MongoDB with 800M+ records. I wanted to do some cleanup, but the remove operation is really really (unusably) slow - even deleting 1000 records can take 10+ minutes. The ...
5
votes
0answers
1k views

Understanding MongoDB Log warning

In my MongoDB log, I am seeing these lines of messages: 2016-04-05T00:03:42.904+0000 I COMMAND [ftdc] serverStatus was very slow: { after basic: 200, after asserts: 240, after backgroundFlushing: ...
5
votes
2answers
830 views

Chunk Size is shown as 1 KB in mongo db logs even it is set to 300 MB

I am running a mongo cluster. Chunk size set is 300 MB but for today morning it is showing me in logs that chunk size is 1024 Byte. I checked in current op there also it is showing chunks of 1024 byte....
5
votes
1answer
1k views

Mongo replication lag slowly increasing

I am running a replica-set in production with slaveOk = false using mongo 2.0.7 in AWS The replication lag on one of the servers is close to 58 hours. This replication lag is sometimes decreasing ( at ...
4
votes
2answers
8k 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 ...
4
votes
3answers
11k views

Write Locks in Mongo DB

I read somewhere that MongoDB holds db level write lock, does this mean that when someone updates any collection others are not allowed to read other collection or how it works. Also when someone ...
4
votes
1answer
5k 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('...
4
votes
3answers
5k views

Is findOne() in mongoDB deprecated

Is findOne() in MongoDB deprecated? I am asking this because when I use findOne() in WebStorm the IDE puts a line through findOne() and gives a message saying findOne() is deprecated and to find ...
4
votes
2answers
11k views

Can MongoDB be configured to sit behind a load balancer?

According to this post: In a single replica set, you cannot distribute writes, they all must go to the primary. You can distribute reads to the secondaries already, via Read Preferences as you ...
4
votes
3answers
8k views

MongoDB refuse to start, operation not permitted

When I try to run mongod --dbpath=./data I get the following error: 2017-09-20T21:47:55.720+0200 I CONTROL [initandlisten] MongoDB starting : pid=20500 port=27017 dbpath=./data 64-bit host=debian ...
4
votes
3answers
9k views

How do I ensure I always connect to Primary/Secondary node in a MongoDB ReplicaSet?

I have a 3 node replica set running on 3 different servers. I have finished setting it up and everything works great. Now I want to give my users two connection strings: Connect to this "xyz" for ...
4
votes
3answers
16k views

How to views all documents in a particular collection of database in MongoDB through mongo Shell?

In the MongoDB shell, how to views all documents in a particular collection for the current database that I'm using? when i am trying through the query > db.getCollection().find() To getting ...
4
votes
1answer
968 views

How to generate this MongoDB diagnostics HTML report?

I'm seeing this kind of report in many JIRA bugs and I want to generate it for my mongo instance. What software was used for generating it?
4
votes
10answers
17k 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 ...
4
votes
2answers
24k 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
3k views

Multiple BindIp in MongoDB 3.4.1 on Debian Jessie

I just upgraded from MongoDB 3.2 to 3.4.1. /etc/mongod.conf had a multiple BindIP: bindIp: [127.0.0.1,192.168.20.1] This is not working anymore. I get this error : Scalar option 'net.bindIp' must ...
4
votes
3answers
6k 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 ...
4
votes
3answers
17k views

How to run MongoDB as a non root user in Linux?

I can start MongoDB as $sudo service mongod start. When I start without sudo it gives me this error: /etc/init.d/mongod: line 58: ulimit: open files: cannot modify limit: Operation not permitted /etc/...
4
votes
1answer
8k views

How to convert _id field of all existing documents from type String to Number

At one of my collections I have an _id field that stores numbers. The field was defined originally in the Mongoose model as String. However, all the data concerning this field in the collection ...
4
votes
1answer
2k views

Hash index use case in MongoDB

Recently MongoDB added hash index to its features but in the documentation doesn't explain much about hash index use case and its privileges to normal MongoDB index. So I'll be grateful if you guide ...
4
votes
2answers
5k 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 ....
4
votes
1answer
3k views

How does MongoDB store data in RAM?

I'm trying to sift through the remains of an event that was causing us a lot troubles. Aside from report to management about what happened, I'm trying to gain a much better understanding of how this ...
4
votes
2answers
2k 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(), ...
4
votes
1answer
4k views

MongoDB: operator to match arrays whose elements are all contained in a specified array

The $all operator selects the documents where the value of a field is an array that contains all the specified elements. In my situation I need the opposite: an operator that selects the documents ...
4
votes
2answers
11k views

Can't run rs.initiate() when do mongodb replication set

Using CentOS 7. MongoDB version: 3.2.15 Hostname: node1 Make directory: mkdir /mongo-metadata /etc/mongod.conf # mongod.conf # for documentation of all options, see: # http://docs.mongodb.org/...
4
votes
2answers
8k 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-: ...
4
votes
3answers
5k views

Why does Mongo query hang for a long time when creating index?

We are migrating our single Mongo instance to Mongo cluster with sharding. I haven't started sharding yet. However, I found out when I try to add an index, I can't query any collection anymore. We don'...
4
votes
3answers
27k views

How to show all users of all databases in mongodb?

I know show users or db.getUsers() can show all users in current database in mongodb, but how to list all users in all databses for ease of management as an administrator?
4
votes
1answer
4k views

Mongo replica set with no PRIMARY/SECONDARY, members are STARTUP2 and RECOVERING

I have a mongo cluster with 6 replica sets. 5 are fine, one is not. Each replica set has three members. Here is the rs.status() for it: { "set" : "rs_5", "date" : ISODate("2015-12-16T02:37:...
4
votes
2answers
7k views

MongoDB uses only one index on simple query with sorting

So the problem is that I'm having a huge collection and I'm trying to run a query that filters and sorts on only fields that have indexes on them. I have these two indexes: db.getCollection('product'...
4
votes
1answer
5k views

Mongodb high lock percentage / slow queries

I'm working with an application using MongoDB that is getting a fairly large number of incoming requests and I've noticed that the responses are getting slower as the number of requests get higher. ...
4
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 ...
4
votes
1answer
5k views

Why does mongodb virtual memory get so large

I have just compiled MongoDB in my linuxOS and not insert any data into DB. The virtual memory is getting very large, about 40G. ps aux|grep mongod mongodb 176574 0.0 0.0 423784 39008 pts/308 ...
4
votes
1answer
1k 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 ...