Upgrade MongoDB from 2.6 to 3.4 on Ubuntu 16.04 - mongodb

I have Ubuntu 16.04 machine with MongoDB 2.6 install.
Now I want to upgrade MongoDB to latest version, i.e., 3.4
What is the best way to Upgrade?
From MongoDB website, I found that, I must have to follow step by step upgrade. e.g, 2.6 to 3.0, then 3.0 to 3.2, then 3.2 to 3.4 Is this correct?
What is the best and safe way to upgrade MongoDB, so I can complete it with less down time?

Related

MongoDB upgrade version of dbpath

I have the database files, /data/db/ (these are from the version 3.6.3 MongoDB)
But I looked the documentation of MongoDB up and I saw and it isn't possible anymore to install the MongoDB 3.6.3.
So how am I able to update the old database files to use them with the version MongoDB 4.4
Thank you very much for your help!
You must do it one by one:
Upgrade a Standalone to 4.0
The following steps outline the procedure to upgrade a standalone mongod from version 3.6 to 4.0.
Upgrade a Standalone to 4.2
he following steps outline the procedure to upgrade a standalone mongod from version 4.0 to 4.2
Upgrade a Standalone to 4.4
The following steps outline the procedure to upgrade a standalone mongod from version 4.2 to 4.4.

Downgrading mongoDB from 4.4 to 3.6

I am working in Ubuntu 20.04 and I have previously installed mongodb v4.4. Due to some requirements I want to downgrade both my "shell" and "db" to 3.6 to function on the server. I am coming from this How to downgrade mongoshell version 4.4 to 3.6?
But it seems it is not downloading
Is there any other technique by which I can have this version?

Add a Mongodb 3.6 member to a replica set running Mongodb 3.2 [duplicate]

I'm trying to migrate a cluster from MongoDB 3.4 to 3.6.
When adding a new member which uses MongoDB 3.6, the initial synchronization fails with the following error:
Sync source had no feature compatibility version document at src/mongo/db/repl/replication_coordinator_impl.cpp 679
As I can see, this is a well-known error for those who try to migrate from 3.2 to 3.6. In my case, however, I'm trying to migrate from 3.4 (3.4.14 to be more specific, as reported by db.version() on every instance of the cluster) to 3.6. Since MongoDB official documentation makes no reference to the version 3.5, I'm not sure what am I supposed to do.
What am I doing wrong?
You can definitely upgrade a replica set or sharded cluster from MongoDB 3.4 to 3.6. Upgrades are currently only supported between adjacent major releases, so before upgrading to MongoDB 3.6 you need to complete the upgrade to MongoDB 3.4.
Sync source had no feature compatibility version document
This error message indicates that you've missed a prerequisite in prior upgrades: the replica set does not have featureCompatibilityVersion set to 3.4. This would be the case if you previously upgraded from a version of MongoDB older than 3.4 and haven't enabled backwards-incompatible features yet.
The Feature Compatibility Version (FCV) setting was added in MongoDB 3.4 to provide control over enabling backwards-incompatible data features that could complicate the downgrade process. For example, MongoDB 3.4 adds views, additional index formats (supporting collation and case-sensitive indexes), and a new Decimal BSON type.
After upgrading to 3.4 and confirming the likelihood of a downgrade is minimal, the FCV should be set using:
db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )
This is a prerequisite to upgrading to MongoDB 3.6 which has a similar final upgrade step to enable backwards-incompatible 3.6 features by setting the FCV to "3.6".
You can check the current FCV using:
db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
Since MongoDB official documentation makes no reference to the version 3.5, I'm not sure what am I supposed to do.
MongoDB 3.5 (and releases with the second component being an odd number) are not referred to in the upgrade notes as those are development releases (see: MongoDB version numbers). MongoDB 3.5 is the development release series leading up to the MongoDB 3.6 production release series.

Copy database from host with MongoDB 2.4 to host with MongoDB 3.0 via ssh tunnel

I trying to migrate an old application, using MongoDB 2.4 to a host, running MongoDB 3.0 in Docker container. For test purpose I am copying the data via ssh tunnel from the older to the newer version.
As I read about the updating process of MongoDB, first I should use Mongo 2.6 and then 3.0. However my test with avoiding the step with version 2.6 was successful and the database works fine. Could somebody explain me is that really possible or I have misunderstood something? It's really strange for me.
Upgrading from 2.4 to 2.6, prior to upgrading to 3.0 is a requirement according to the documentation:
To upgrade an existing MongoDB deployment to 3.0, you must be running
2.6. If you’re running a version of MongoDB before 2.6, you must upgrade to 2.6 before upgrading to 3.0. See Upgrade to 2.6 for the
procedure to upgrade from 2.4 to 2.6. Once upgraded to MongoDB 2.6,
you cannot downgrade to any version earlier than MongoDB 2.4.
Having said that, if you have run the corresponding test cases for your application, with a good test coverage, the indexes are working properly, and nothing has been broken I can not see a reason to worry about but ideally they suggest to migrate to 2.6 and then make the move to 3.0 to avoid data corruption.

cannot use operators in mongodb version 3.4

I recently upgrade the version of mongodb. My previous version was 3.2
When I write on console;
mongod --version
db version v3.4.2
But I cannot use operators that comes with new version of mongodb (3.4) in MongoChef.
For example this one; https://docs.mongodb.com/manual/reference/operator/aggregation/indexOfBytes/
MongoChef doesn't complete or when I try to execute the string it throws an erroras;
the selection: invalid and cannot be executed.
Should I upgrade MongoChef as well? Why I cannot use the operators in version 3.4 while my mongodb version is it.
Check your MongoChef Version as only MongoChef vertion 4.5 + are compatible with 3.4 according to the release notes.
With that, I would recommend upgrading to the latest MongoChef release 5.1 - https://studio3t.com/download/
MongoChef is now called Studio 3T now.