Upgrade Guide From MongoDB 3.2 to 3.4 and 3.4 to 4.0 - TBladen/mango GitHub Wiki

STEP-1: Install Requirements:

a) Mongo Requirements:

See more: Build-Mongodb-From-Source

For 4.0

To build the master branch, you will need:

A modern and complete C++11 compiler. One of the following is required:
  VS2015 Update 2 or newer
  GCC 5.4.0
  Clang 3.4 (or Apple XCode 5.1.1 Clang) or newer
On Linux and macOS, the libcurl library and header is required. MacOS includes libcurl.
  Fedora/RHEL - dnf install libcurl-devel
  Ubuntu/Debian - apt-get install libcurl-dev
Python 2.7

For 3.4

To build the master branch, you will need:

A modern and complete C++11 compiler. One of the following is required:
    VS2015 Update 2 or newer
    GCC 5.3.0
    Clang 3.4 (or Apple XCode 5.1.1 Clang) or newer
Python 2.7
SCons 2.3.5 or newer (for MSVC 2015 support)

**b) Robo 3T Requirements (Optional & for 3.4) **

Windows Only:
Due to compiler change use Qt installer msvc2015 version instead of msvc2013.
Go to http://download.qt.io/archive/qt/5.7/5.7.0/
Download and install qt-opensource-windows-x86-msvc2015_64-5.7.0.exe

STEP-2: Update & Build OpenSSL:

a) Check and update project OpenSSL version if it is changed by MongoDB.

https://www.openssl.org/source/old/1.0.1/

Method-1:
Check the file version of E:\Program Files\MongoDB\Server\4.0\bin\ssleay32.dll

Method-2:
OpenSSL version used by Mongo can be seen in MongoDB 3.4 server logs at start:

C:\Program Files\MongoDB\Server\3.4>bin\mongod.exe --port 27018  
...
2017-06-08T18:05:32.660+0300 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1u-fips  22 Sep 2016  
...

b) Build OpenSSL

See build pages on https://github.com/Studio3T/robomongo/wiki

STEP-3: Update & Build robomongo-shell Repo:

a) Update robomongo-shell Version

  • Find the latest release version on https://www.mongodb.com/download-center/community (e.g. 4.0.4 for for 4.0)
  • Check out new robo-shell branch from mongo branch r3.4.3 (for 4.0 'r4.0.4' used) tag. (Find r versions instead of v) Update the tags if required:
    git remote add upstream https://github.com/mongodb/mongo.git
    git fetch upstream
    

b) Build robomongo-shell

c) Apply Robomongo changes into new robomongo-shell.

d) Build robomongo-shell again after code changes

STEP-4: Update & Build robomongo Repo:

a) Update \robomongo\bin\configure.bat with updated compiler (if needed)
Example: From "Visual Studio 12 2013 Win64" to "Visual Studio 14 2015 Win64"

b) Update \robomongo\cmake\FindMongoDB.cmake with updated versions of 3rd party libs.
Example: boost, mozjs etc..

c) Update `\robomongo\cmake\mongodb\ release and debug objects for all OSes.

Do the steps for each platform:

  • Delete file build/opt/mongo/mongo.exe for Windows (or build/opt/mongo/mongo for other OSes)
  • robomongo-shell\bin\build > release-link-objects.txt // Windows
  • robomongo-shell\bin\build debug > debug-link-objects.txt // Windows
  • For MacOS (and probably for Ubuntu too) use the program in section z-1) Object File Parser
  • Copy object file names from out.txt into robomongo\cmake\mongodb\*.objects files accordingly.
  • For next step, if Robo build fails, make sure there is no other file types than *.o. in robomongo\cmake\mongodb\*.objects files.

More:
https://github.com/Studio3T/robomongo/blob/master/cmake/mongodb/README.md

d) Build robomongo
See https://github.com/Studio3T/robomongo/wiki

e) Connect to localhost If crashes during connection are seen, make sure Robo do the same as "mongo.exe" initializes mongo shell.

See: https://github.com/Studio3T/robomongo/commit/5dd5019f57e4c3195b7daa1ec660d458ec00c79a#diff-511460a50dc740480d3b180d969bfe76R43

f) Connect to Mongo Atlas to test SSL and Replica Set

  • Make sure robo-shell SSL patches are applied

g) Connect to remote server with SSH

h) Check run, install and pack commands are working

z) Appendix

z-1) Object File Parser
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>

using namespace std;

/*  
  This command line program extracts object files from *-link-objects.txt file (robo-shell build output) 
  and creates *.objects file content (robomongo\cmake\mongodb\*.objects)
*/
int main()
{
    std::ifstream inFile("in.txt");  // release-link-objects.txt from robo-shell build
    ofstream outFile("out.txt");   // Copy content of this file into Robo *.objects file

    std::string line;
    std::string const gcc("gcc -o"), gpp("g++ -o");
    auto gccLine = [&] { return line.compare(0, gcc.length(), gcc) == 0; };
    auto gppLine = [&] { return line.compare(0, gpp.length(), gpp) == 0; };

    while (std::getline(inFile, line))
    {
        if (gccLine() || gppLine() && line.find(".o") != std::string::npos)
        {
            // Cut 7 chars from line start
            auto const objStr = line.substr(7, line.find(".o") - 5);
            if (objStr.find(' ') == std::string::npos) { // Process only if it has no space
                outFile << objStr << ' ';
                // cout << objStr << endl; // for debug
            }
            // Old logic
            // cout << line.substr(7, line.find(".o") - 5) << endl; // for debugging
        }
    }

    outFile.close();
}
⚠️ **GitHub.com Fallback** ⚠️