Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve featureCompatibilityVersion issue between MongoDB 3.6 and 4.2?

Tags:

mongodb

I recently uninstalled MongoDB 3.6 and then installed MongoDB 4.2. When I navigated to MongoDB/Server/4.2/bin and executed mongo, I got the following error message:

$ mongod                                                                                                                                                                             
2019-10-22T21:16:36.723-0400 I  CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'                                       
2019-10-22T21:16:37.217-0400 I  CONTROL  [initandlisten] MongoDB starting : pid=9376 port=27017 dbpath=C:\data\db\ 64-bit host=DESKTOP-LF34G1M                                       
2019-10-22T21:16:37.217-0400 I  CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2                                                                               
2019-10-22T21:16:37.217-0400 I  CONTROL  [initandlisten] db version v4.2.1                                                                                                           
2019-10-22T21:16:37.218-0400 I  CONTROL  [initandlisten] git version: edf6d45851c0b9ee15548f0f847df141764a317e                                                                       
2019-10-22T21:16:37.218-0400 I  CONTROL  [initandlisten] allocator: tcmalloc                                                                                                         
2019-10-22T21:16:37.218-0400 I  CONTROL  [initandlisten] modules: none                                                                                                               
2019-10-22T21:16:37.218-0400 I  CONTROL  [initandlisten] build environment:                                                                                                          
2019-10-22T21:16:37.218-0400 I  CONTROL  [initandlisten]     distmod: 2012plus                                                                                                       
2019-10-22T21:16:37.218-0400 I  CONTROL  [initandlisten]     distarch: x86_64                                                                                                        
2019-10-22T21:16:37.219-0400 I  CONTROL  [initandlisten]     target_arch: x86_64                                                                                                     
2019-10-22T21:16:37.219-0400 I  CONTROL  [initandlisten] options: {}                                                                                                                 
2019-10-22T21:16:37.230-0400 I  STORAGE  [initandlisten] Detected data files in C:\data\db\ created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wire
dTiger'.                                                                                                                                                                             
2019-10-22T21:16:37.231-0400 I  STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=1498M,cache_overflow=(file_max=0M),session_max=33000,eviction=(threads_min=4,threa
ds_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000,close_scan_interval=10,close_handle
_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress],                                                                                               
2019-10-22T21:16:37.295-0400 I  STORAGE  [initandlisten] WiredTiger message [1571793397:294196][9376:140704250879568], txn-recover: Recovering log 22 through 23                     
2019-10-22T21:16:37.439-0400 I  STORAGE  [initandlisten] WiredTiger message [1571793397:438812][9376:140704250879568], txn-recover: Recovering log 23 through 23                     
2019-10-22T21:16:37.561-0400 I  STORAGE  [initandlisten] WiredTiger message [1571793397:560490][9376:140704250879568], txn-recover: Main recovery loop: starting at 22/896 to 23/256 
2019-10-22T21:16:37.712-0400 I  STORAGE  [initandlisten] WiredTiger message [1571793397:712086][9376:140704250879568], txn-recover: Recovering log 22 through 23                     
2019-10-22T21:16:37.807-0400 I  STORAGE  [initandlisten] WiredTiger message [1571793397:806834][9376:140704250879568], txn-recover: Recovering log 23 through 23                     
2019-10-22T21:16:37.883-0400 I  STORAGE  [initandlisten] WiredTiger message [1571793397:882664][9376:140704250879568], txn-recover: Set global recovery timestamp: (0,0)             
2019-10-22T21:16:37.934-0400 I  RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)                                                                           
2019-10-22T21:16:37.943-0400 I  STORAGE  [initandlisten] Timestamp monitor starting                                                                                                  
2019-10-22T21:16:37.947-0400 I  CONTROL  [initandlisten]                                                                                                                             
2019-10-22T21:16:37.947-0400 I  CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.                                                                 
2019-10-22T21:16:37.948-0400 I  CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.                                                
2019-10-22T21:16:37.948-0400 I  CONTROL  [initandlisten]                                                                                                                             
2019-10-22T21:16:37.948-0400 I  CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.                                                                              
2019-10-22T21:16:37.948-0400 I  CONTROL  [initandlisten] **          Remote systems will be unable to connect to this server.                                                        
2019-10-22T21:16:37.948-0400 I  CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP                                                   
2019-10-22T21:16:37.949-0400 I  CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to                                              
2019-10-22T21:16:37.949-0400 I  CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the                                                  
2019-10-22T21:16:37.949-0400 I  CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning.                                                        
2019-10-22T21:16:37.949-0400 I  CONTROL  [initandlisten]                                                                                                                             
2019-10-22T21:16:37.959-0400 I  SHARDING [initandlisten] Marking collection local.system.replset as collection version: <unsharded>                                                  
2019-10-22T21:16:37.965-0400 F  CONTROL  [initandlisten] ** IMPORTANT: UPGRADE PROBLEM: Found an invalid featureCompatibilityVersion document (ERROR: BadValue: Invalid value for ver
sion, found 3.6, expected '4.2' or '4.0'. Contents of featureCompatibilityVersion document in admin.system.version: { _id: "featureCompatibilityVersion", version: "3.6" }. See http:
//dochub.mongodb.org/core/4.0-feature-compatibility.). If the current featureCompatibilityVersion is below 4.0, see the documentation on upgrading at http://dochub.mongodb.org/core/
4.0-upgrade-fcv.                                                                                                                                                                     
2019-10-22T21:16:37.965-0400 I  NETWORK  [initandlisten] shutdown: going to close listening sockets...                                                                               
2019-10-22T21:16:37.966-0400 I  -        [initandlisten] Stopping further Flow Control ticket acquisitions.                                                                          
2019-10-22T21:16:37.966-0400 I  STORAGE  [initandlisten] Deregistering all the collections                                                                                           
2019-10-22T21:16:37.966-0400 I  STORAGE  [initandlisten] Timestamp monitor shutting down                                                                                             
2019-10-22T21:16:37.967-0400 I  STORAGE  [initandlisten] WiredTigerKVEngine shutting down                                                                                            
2019-10-22T21:16:37.967-0400 I  STORAGE  [initandlisten] Shutting down session sweeper thread                                                                                        
2019-10-22T21:16:37.968-0400 I  STORAGE  [initandlisten] Finished shutting down session sweeper thread                                                                               
2019-10-22T21:16:37.968-0400 I  STORAGE  [initandlisten] Shutting down journal flusher thread                                                                                        
2019-10-22T21:16:38.037-0400 I  STORAGE  [initandlisten] Finished shutting down journal flusher thread                                                                               
2019-10-22T21:16:38.037-0400 I  STORAGE  [initandlisten] Shutting down checkpoint thread                                                                                             
2019-10-22T21:16:38.038-0400 I  STORAGE  [initandlisten] Finished shutting down checkpoint thread                                                                                    
2019-10-22T21:16:38.038-0400 I  STORAGE  [initandlisten] Downgrading WiredTiger datafiles.                                                                                           
2019-10-22T21:16:38.188-0400 I  STORAGE  [initandlisten] WiredTiger message [1571793398:187822][9376:140704250879568], txn-recover: Recovering log 23 through 24                     
2019-10-22T21:16:38.273-0400 I  STORAGE  [initandlisten] WiredTiger message [1571793398:272644][9376:140704250879568], txn-recover: Recovering log 24 through 24                     
2019-10-22T21:16:38.365-0400 I  STORAGE  [initandlisten] WiredTiger message [1571793398:365403][9376:140704250879568], txn-recover: Main recovery loop: starting at 23/2048 to 24/256

2019-10-22T21:16:38.533-0400 I  STORAGE  [initandlisten] WiredTiger message [1571793398:532944][9376:140704250879568], txn-recover: Recovering log 23 through 24                     
2019-10-22T21:16:38.642-0400 I  STORAGE  [initandlisten] WiredTiger message [1571793398:642615][9376:140704250879568], txn-recover: Recovering log 24 through 24                     
2019-10-22T21:16:38.722-0400 I  STORAGE  [initandlisten] WiredTiger message [1571793398:722405][9376:140704250879568], txn-recover: Set global recovery timestamp: (0,0)             
2019-10-22T21:16:39.004-0400 I  STORAGE  [initandlisten] shutdown: removing fs lock...                                                                                               
2019-10-22T21:16:39.005-0400 I  CONTROL  [initandlisten] now exiting                                                                                                                 
2019-10-22T21:16:39.005-0400 I  CONTROL  [initandlisten] shutting down with code:62     

The error which confuses me is: UPGRADE PROBLEM: Found an invalid featureCompatibilityVersion document (ERROR: BadValue: Invalid value for version, found 3.6, expected '4.2' or '4.0'. This does not seem to align with what I'm seeing below:

> db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
{ "featureCompatibilityVersion" : { "version" : "4.2" }, "ok" : 1 }

How am I able to fix this featureCompatibilityVersion issue?

like image 249
Josh Evans Avatar asked Oct 23 '19 01:10

Josh Evans


People also ask

Is MongoDB 5 backwards compatible?

Starting in MongoDB 5.0, secondaryDelaySecs replaces slaveDelay . This change is not backwards compatible.

What is Featurecompatibilityversion in MongoDB?

In MongoDB, the setFeatureCompatibilityVersion command enables or disables the features that persist data incompatible with earlier versions of MongoDB.


1 Answers

The answer lies in the error message.

If the current featureCompatibilityVersion is below 4.0, 
see the documentation on upgrading at 
https://docs.mongodb.com/manual/release-notes/4.2/#upgrade-procedures

That page points out that if you have a version 3 installation, first you have to upgrade to 4.0. It doesn't help that on Macs, homebrew offers a mongodb-community installation that does not specify a version number. Currently, mongodb-community is 4.2.

What I did is:

brew services stop mongodb-community
brew uninstall mongodb-community
brew install [email protected]
brew install mongodb-community-shell
brew services start [email protected]
mongo
db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
[ it gave: { "featureCompatibilityVersion" : { "version" : "3.6" }, "ok" : 1 } ]
db.adminCommand( { setFeatureCompatibilityVersion: "4.0" } )
ctrl-c
brew services stop [email protected]
brew uninstall [email protected]
brew uninstall mongodb-community-shell [you get a new one with the next step]
brew install mongodb-community
brew services start mongodb-community

Which doesn't exactly trip off the tongue but did work for me without too much trouble.

like image 189
emrys57 Avatar answered Oct 07 '22 11:10

emrys57