New answers tagged

0

If you know start _id and end _id then you can retrieve the bulk you inserted using query like this: db.yourCollection.find({_id:{$gt:ObjectId("56e13d5aed63a8477a7e2e78"), $lt: ObjectId("570f5a27b2d1a50996d3a0f0")}}) Replace the default mongodb ObjectIds with your _id fields. Also, if the _id you are using is default mongodb ObjectId then you can easily ...


0

If all else fails, on Ubuntu 14.04 LTS running on AWS, try this... ubuntu@foo $ sudo -u mongodb bash # OR whatever shell (zsh) mongodb@foo $ mongod --dbpath /data/db --fork OF COURSE, you'll add a much larger set of flags to the command.


1

You can execute mongodump from the remote server as mentioned below: mongodump --host <ip-of-mongodb-server> --port <port-number-of-mongod> --out <some-directory> This is required mongo server to be accessible from the remote server. This dump file can be then compressed and archived on remote host or s3. If the mongo server is not ...


1

Typically, you don't. Thinking of your nodes in terms of primary or secondary is the wrong way to approach it. Since standard data bearing nodes should have the same dimensions, it is better to think of them as replica set members, one of which gets elected to primary. Since the drivers are replica set aware and know which the current primary is and you are ...


0

I faced the same issue then looked into Mongos log file and it was saying can't authenticate to hostname as internal user, error: Authentication failed. Please see here: internal user authentication and happens with SecKey file and auth- Enabled. Resolution I opened mongod.conf file and security: authorization: enabled keyFile: ...


2

You have a major mistake in your code. MongoClient creates a connection pool. Even in large applications, it is hence usually a singleton. So you should have it as a global variable, initialize it in main and reuse it in each runnable. Which is perfectly fine, since MongoClient is thread safe. Another thing to keep in mind is that although the single ...


0

I had this on Raspberry Pi as well as on my Ubuntu server. “Job for mongod.service failed. See 'systemctl status mongod.service' and 'journalctl -xn' for details.” I had this issue on different occasions for different reasons: Mis-named .conf file – The mongodb script (which I moved to /etc/init.d/mongodb), line 57 CONF=/etc/mongod.conf when my ...


0

As you already said I've tried mongodump --quiet As per mongodb documentation Here Runs the mongodump in a quiet mode that attempts to limit the amount of output. This option suppresses: output from database commands replication activity connection accepted events connection closed events mongodump is an useful tool to backup Mongo database. ...


1

The problem is that MongoDB does not support file versions natively. So all we can do is to store the different versions and have some sort of metadata indicating the versions, then find the according file. Adding the complete metadata to fs.files (the wrong way) GridFS can store custom data in the metadata field of the files collection. > ...


3

First of all, you can use a pipe mongodump -h sourceHost -d yourDatabase … | mongorestore -h targetHost -d yourDatabase … This reduces the time, as each document read will more or less instantly be restored on targetHost. However, this has the disadvantage that you might run into problems if the procedure is aborted for some reason, for example of a ...


2

I deem that there are multiple (very important) aspects that you need to consider before deciding which tool you are going to employ to develop your project. The primary objective should be to manage the pertinent data as it is, a quite valuable organizational asset, and a reliable manner to achieve said objective is by way of technical means that are ...


0

You can replicate data from one server to others using Replication feature in MongoDB. The replica set ensures high availability and redundancy of you mongodb data in case if node failure. In your case, you can create a replica set of 3 nodes (PRIMARY, SECONDARY, ARBITER). When one of the server goes down, Secondary would be promoted as PRIMARY which ...


1

If you are running on Linux, you can use control groups to limit MongoDB memory as shown in the following article: Easy Steps to Limit Mongodb Memory Usage by Ramakanta Sahoo On Windows, a similar technique using the Windows System Resource Manager is described in: Limit MongoDB memory use on Windows without Virtualization by Simon Green


-3

Fill the SQL tables with the worst case, a looooooot of happy users! Then see how performant it is with a lot of queries and then try to copy the data into Mongo. Might help you decide when the best for switching is. I usually go with NOW! ;-) Also not sure what SQL offers these days, but in Mongo you can do sharding across multiple servers if the ...


0

Agree with Mark mostly, but Mongo is not that bad. The chirp table would be better with the userid instead of the name, and then using the right calls, you could populate the data from the user collection/table, that is a lookup in an indexed field, pretty fast in Mongo. The indexes themselves are not to worry about, as long as you keep them flat and only ...


2

Given your description I strongly suggest against using MongoDB. Not because it would necessarily a bad choice (although I believe it is in your case for reasons other than pure technical ones). Here are the points that caught my eye. Data modeling Trying to use MongoDB with relational data model with no adaptations almost always leads to tears and misery ...


0

Did you follow the guidelines? To upgrade an existing MongoDB deployment to 2.6, you must be running 2.4. If you’re running a version of MongoDB before 2.4, you must upgrade to 2.4 before upgrading to 2.6. I have upgraded from 2.4 to 2.6 with no issues on a sharded cluster.


2

This depends on so much stuff. What are you building and how complex will your DB queries be? Hobby or professional use? Is the data critical? Do you need transaction safety? Do you already have all the data, in what format? or do you start from scratch? how many users do you expect? how many requests? Are you bound to PHP or can you use Node.JS? Is it a ...


2

Connecting to a replica set Most drivers will show the following behavior, as far as I know If only a single node is given, the driver will simply connect to this node. If the replicaSet option is given in the connection string, the driver will start to explore said replica set to identify all non-hidden members, regardless of the number of nodes given in ...


2

You've seen the right behaviour since the default storage engine in 3.2 is WiredTiger(WT). The Wired Tiger provides up to 80% of the data compression to your data. Just to verify please note db stats before migrating and then after migrating the dbs to 3.2 to ensure you have got your data back.


1

I have noticed the same thing in last week. Sometimes, the mongo shell returns any empty array: Try running the currentOp() many times to get the progress. Use use db command and then perform db.currentOp()


1

The valid and live members from replica set will automatically detect the arbiter which is in your replica set but not specified in connection. The driver will redirect the request to only Primary and secondaries knowing that arbiter will not serve any requests. It helps in voting in case of failover. However, its always good idea to add all members in ...


2

You are mixing concepts here. Transactions are related to atomicity and guarantee that multiple operations are either executed as a whole or not at all. Consistency, however is (simplified) the guarantee that after each successful transaction or operation applied, the database is in a a valid, usable state. An example Note This example is simplified ...


2

By-and-large, you can't. Mongo offers atomic actions per document ie a single document will be successfully written or rolled back. There is no way (as of v3.2) to ensure a set of documents will be all written or all rolled back. Document self-consistentcy can be built into the JSON written. Coming from a relational point of view, think of it like a widely ...


0

If you have no space on the disk you should just simple dump the database, drop it and restore again.


1

You need to apply what MongoDB Docs say https://docs.mongodb.org/manual/tutorial/transparent-huge-pages/ I installed MongoDB 3.0.8 as couple of months ago and got the same warnings. This setting was set by Amazon. First thing to do is create a script that can enabled and disable Transaparent Pages. Documentation gives this: #!/bin/sh ### BEGIN INIT INFO # ...


0

As you demonstrated in your question, there is a clear relational structure to your data. There are different objects (Users, Requests, and Messages), which all relate to each other, potentially in multiple ways. These objects have attributes (eg driver or passenger names) that would be referenced many times from other objects (Requests). This requires ...



Top 50 recent answers are included