11

The problem can be solved by: Backing-up all the databases (using mongodump) Removing every file in /data/db, due to their incompatibility with the newer version: rm -rf /data/db/* Restarting the MongoDB service Restoring all the databases (using mongorestore)


5

This is a general architectural problem with the WiredTiger storage engine. It is now being discussed here: https://jira.mongodb.org/browse/WT-5479 Long story short, your number of open files is too high. If you can, consider removing unnecessary indexes, e.g. indexes on small collections. You could also explore the new wildcard indexes introduced in ...


4

You need to add like this: let date = new Date().toISOString(); let isoDate = new Date(date); Hope it works.


3

Seems like the point of checkpoints was to move fast, but at the risk of losing a minute of data at a time. Whereas the journal is all about accounting for everything. So why have both? Seems like having the Journal kind of overrides any gains that Checkpoints were supposed to give. Although journal and checkpoint processes both write data to disk, they ...


3

according to https://docs.mongodb.com/manual/reference/built-in-roles/ the "readwrite" is to blame ... readWrite Provides all the privileges of the read role plus ability to modify data on all non-system collections and the system.js collection. The role provides the following actions on those collections: collStats convertToCapped ...


3

Basically, I made it with db.updateUser. On the doc, it says the following: passwordDigestor : string Optional. Indicates whether the server or the client digests the password. Available values are: "server" (Default) The server receives undigested password from the client and digests the password. "client" (Not compatible ...


2

There is an OPEN issue already created in MongoDB JIRA for the same. As per the issue, MongoDB index creation is not Multi-Threaded. use multiple cores for index sort-phase Multi-threaded index creation UPDATE Try increasing the maxIndexBuildMemoryUsageMegabytes parameter value. The default value is 500 MB. What does it do? Limits the amount of ...


2

I have met similiar problem with admin db, when upgrade from old mongodb 3.4 to 4.2. Solution is to mongodump all dbs and delete /var/lib/mongodb, then mongorestore all dbs back. STORAGE [initandlisten] exception in initAndListen: MustDowngrade: Collection does not have UUID in KVCatalog. Collection: admin.system.users, terminating 2019-09-24T21:59:55....


2

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 ...


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 ...


2

mongoreplay is currently not included in the Windows installation packages (as at MongoDB 4.0). This tool uses the libpcap packet capture library which is available on most UNIX/Linux platforms but is not standard on Windows. There's a relevant feature request to watch/upvote in the MongoDB Jira issue tracker: TOOLS-1730: Release mongoreplay for windows. ...


1

ISODate is a mongo shell type, it does not exist in Node. You can format the JS Date object any way you wish in your application.


1

Mongodump don't understand Timestamp-function, so... mongodump $credentials -d local -c oplog.rs --query '{"ts":{"$timestamp":{"t":1591199252,"i":0}}}' --out /test/


1

Starting with question 2: I have found no clear answer, but it is now obvious to me that fs snapshots is not sufficient for MongoDB version 4.0.19. We'll upgrade MongoDB if we can and will start using mongodump in addition to the fs snapshots. We'll probably stop MongDB before snapshots are made. At this point I do not know how corrupt files goes undetected ...


1

Yes, it is not a good idea to use a dynamic (changing value) like an ObjectId as a field name. To query a specific bookmark you are looking for a specific value for a specific field. And also, to index bookmarks fields it is not possible as the field names are changing. You can use something like this, for the bookmarks field: bookmarks: [ { post_id: &...


1

Wernfried Domscheit said: You don't need to copy any data in a replicat set. Just remove entire directory and start the service. The replicat set will trigger an inital sync and copies all data. In case you like to take a copy from dbPath you should stop the service or at least lock it with db.fsyncLock() (and of course unlock afterwards with db.fsyncUnlock(...


1

Using a read concern of "majority" does not cause the read operation to be submitted to multiple nodes. When replication.enableMajorityReadConcern is true (default in MongoDB 3.6+) each node will note the most recent write operation that has been acknowledged by a majority of the voting nodes, and keep a snapshot of the data at that point in time. ...


1

If you login directly to that shard (and not mongos), you can drop that collection. After you have logged in to that shard, you can check with db.collection.find() command that there is no data what you want to save, before you drop it.


1

Reference on how shard chunks work: https://docs.mongodb.com/v4.0/core/sharding-data-partitioning/ MongoDB uses the shard key associated to the collection to partition the data into chunks. A chunk consists of a subset of sharded data. Each chunk has a inclusive lower and exclusive upper range based on the shard key. The mongos routes writes to ...


1

In MongoDB 3.6+ you can add a pipeline to your $lookup stage to include additional join conditions. A solution was less obvious than I expected since your source lookup field is an array, but the following should return the expected outcome: db.collection1.aggregate([ { $match: { _id: "col1id1" }}, // Filtered lookup based on agg ...


1

Some tricks that help with performance issues: Use database limit/skip(both in queries and aggregations), and implement application pagination. If you expect users to only look for 50 records at a time, why are you sending 50,000? When doing the aggregation, use the $lookup stage after filtering the collection ([$match,$lookup]). Avoid doing the whole ...


1

Let's say I have a collection with 20 fields and a query that uses 5 of them, to find the documents I need. 3/5 of those fields are always used in the query, 1 for equality comparison, 1 for range comparison (less than) and the other for sorting. The other 2 are being used conditionally, so sometimes they will and others they won't. Those 2, should ...


1

MongoDB's server roles & permissions (as at MongoDB 4.0) don't provide the level of granularity you are after. However, I think this level of control is much better handled in your application logic. For example, even if it were possible to limit write access to the $push operator, there are additional options such as $slice that could cause existing ...


1

I found a solution where i configure rsyslog to pick up that file and forward it to my target server. # RSyslog Configuration for MongoDB /etc/rsyslog.d/mongod.conf $ModLoad imfile $InputFileName /var/log/mongodb/mongod.log $InputFileTag mongodb $InputFileStateFile mongodb-state $InputFileFacility local3 $InputRunFileMonitor local3.* action(type="omfwd" ...


1

The below query will join both the tables and return the sum based on order date, db.order_fact.aggregate([{"$lookup":{"from":"date","localField":"Id_Date","foreignField":"Id_Date","as":"dateDetails"}},{"$unwind":"$dateDetails"},{"$group":{"_id":{"date":"$dateDetails.OrderDate"},"totalPrice":{"$sum":"$TotalPrice"}}}]) Thanks, Rilwan


1

Currently, The lower level you can control the access of resources is at the collection level. One option you can try is to create collections at each user level and give the user access to only that collection.


1

As here Mr. onetwopunch said that I had the same thing and it turned out to be a permissions issue .If the owner of the child process cannot access the log path or the log path does not exist, it will fail. What I did was put the log directory in my home directory: mkdir ~/log mongod --fork --logpath ~/log/mongodb.log


1

First, make sure the MongoDB service is running in the remote machine. Next, check if the MongoDB port is open to the outside network or not. The following will help you check if the 27017 is accessible from an outside machine. nmap -Pn 13.56.140.11 If the port is not enabled, use the following command to expose the port. sudo iptables -I INPUT -p tcp -...


1

What uses that much memory during the resync? There is so many things uses the memory during the resync time, As Mr. SpiXel has clearly defined here The WiredTiger cache settings only controls the size of memory directly used by the WiredTiger storage engine (not the total memory used by mongod). Many other things are potentially taking memory in a MongoDB/...


1

As MongoDB documentation here With WiredTiger, MongoDB utilizes both the WiredTiger internal cache and the filesystem cache. Starting in 3.4, the WiredTiger internal cache, by default, will use the larger of either: 50% of (RAM - 1 GB), or 256 MB. For example, on a system with a total of 4GB of RAM the WiredTiger cache will use 1.5GB of RAM (0.5 * (4 GB ...


Only top voted, non community-wiki answers of a minimum length are eligible