New answers tagged

0

You'll need to run a script to detect for integer/string based values and replace them with the standard Mongo/ISO Date standard. https://docs.mongodb.com/manual/reference/method/Date/


1

Is it possibly to configure MongoDB? ( or it's the way how it's working by default? ) Yes, if you want to control data location, you have to use Zones. Follow this link for a better explanation on how to do it: https://docs.mongodb.com/manual/tutorial/sharding-segmenting-shards/ .


0

Hash indexes do not support unique constraints. So you would need btree (over some value, possibly hash, that you provide). Every insert will dirty some random leaf page, which needs to get written. With a gigantic index, there will be limited opportunity for write combining or consolidation. Can your IO system handle 1000 random writes per second? (A hash ...


2

Can I choose which databases/collections are replicated ? A replica set is a group of mongodb instances that maintain the same data set, so it is necessary for the entire set of data to be replicated between nodes. Is a 2-members (a primary and a secondary) replica set eligible ? A replica set should have an odd number of voting members. If you want ...


0

The "Stocks information" domain potentially fits well with a document database, such as MongoDB. The information available for different financial instruments might vary substantially, which means that a loose schema and the ability to store in-depth information in loosely defined sub-document structures could be useful. Also, you may want to extend the ...


1

Mongo allows the content of a record to change. You can add any values you need and remove any you don't each time you persist a record. The application could have an object class for each state. To mutate a record read it into an instance of whatever class corresponds to its current state. Then map the values you intend to retain to an object of the new ...


1

Check if localhost is getting telnet from command prompt. $ telnet localhost 27017 If it is not getting connected then check /etc/hosts on your machine. It should have uncommented entry as 127.0.0.1 localhost


1

The read/write ticket values are set to 128 to prevent overwhelming WiredTiger with concurrent requests. They are chosen to cater for the typical server hardware. It's generally not recommended to change these values. If you see stalling and observed that the read/write tickets to be maxed out, it's extremely likely that this is just a symptom. The cause of ...


0

Indexes perform better when they have unique values like customer ID, acc number etc. The more unique your indexed field is the less number of records gets picked improving the performance. You can build index on the date field, but would that be unique enough to filter the record you need?


0

No. Copying to Secondary will not help Yes. Primary will replicate the data to Secondary. Follow the steps below Re-creating the replica set is not an option Steps: You can restore it on the Secondary node first Next, Switch your Secondary with restored data to be the new Primary. Now the Primary has latest data Bring down the Secondary, erase its data and ...


0

Update Schema to store two data type values in a field is to define it as array. Updated schema: db.createCollection("nulltest", { validator: { $jsonSchema: { bsonType: "object", properties: { "name": { bsonType: "string" }, "salary": { bsonType: ["double", "null"] ...


0

The issue here is, you've created a compound index on {a:1, b:1, c:1, d:1, e:1, f:1} fields but you're not following the order of the index. So your queries should contain all the fields in the same order that you've constructed your index. Since the field 'f' is in the tail end of the index, your queries will not utilize or even identify it Your queries: ...


0

I faced the same issue (only empty folders were created by mongodump command) with mongodump version 2.4.9, upgrading it helped. You may use following commands to upgrade to version 4.0.4 on ubuntu 14. sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6 echo "deb [ arch=amd64 ] http://repo.mongodb.org/...


0

By default in MongoDB 3.6.4, WiredTiger will try to keep dirty percentage (size of modified data in the cache relative to configured cache size) to below 5% of configured cache size, and the overall cache usage below 80% of configured cache size. The default cache size is described in WiredTiger memory in the documentation Once the percentages goes beyond ...


0

This is not the expected behavior. Since you have the majority members of the replica set online, it should work Just wanted to confirm: Are you using version 4.2? After installing/upgrading the replica set, have you set the feature compatibility version to 4.2 by executing the below command? db.adminCommand( { setFeatureCompatibilityVersion: 4.2 } ) ...


2

This question is for Linux, but for fellow windows users who found their way here and want a windows solution... the problem is your Mongodb service is stopped. So do the following steps: 1) cntrl-alt-del and open your task manager 2) click on 'services' 3) scroll down to MongoDB 4) right click and hit 'start' (or 'restart') go back to ...


1

Just to clarify in case someone stumbles upon this in the future. MongoDB Replicasets need a majority vote to elect a primary. So uneven amount of nodes are advised because a 4 member replica set requires 3 votes as well as a 5 member replica set. But with a 5 member replica set 2 members can go down while with 4 only 1 can go down before the replica set ...


Top 50 recent answers are included