JavaScript Solutions, Competitive programming in JavaScript, MCQ in JS

Thursday, 24 May 2018

MacOS Downgrade or Upgrade MongoDB Versions

By Source, https://en.wikipedia.org/w/index.php?curid=48498452


As we are working on different projects, it may happen that we require the two different mongodb versions to run on same machine or you may get following type of error which I get today only:


name: 'MongoError',
  message: 'The \'cursor\' option is required, except for aggregate with the explain argument',
  operationTime: Timestamp { _bsontype: 'Timestamp', low_: 24, high_: 1527143887 },
  ok: 0,
  errmsg: 'The \'cursor\' option is required, except for aggregate with the explain argument',
  code: 9,
  codeName: 'FailedToParse',
  '$clusterTime':
   { clusterTime: Timestamp { _bsontype: 'Timestamp', low_: 24, high_: 1527143887 },
     signature: { hash: [Object], keyId: [Object] } } }
(node:65062) UnhandledPromiseRejectionWarning: MongoError: The 'cursor' option is required, except for aggregate with the explain argument
    at Function.MongoError.create (/var/www/html/node_modules/mongodb-core/lib/error.js:31:11)


After trying to do some google, I go to know that after MongoDB upgrade this issue has occurred, so I need to downgrade the current MongoDB versions.

My Current MongoDB version is 3.6.X and I need to downgrade it to 3.4.X, so I have done following commands to do this.




As I use brew to install MongoDB I have followed following commands to downgrade the MongoDB.


$ brew update

$ brew install mongodb@3.4


Now it will install it on our machine but we need to force brew to use MongoDB 3.4 version instead of MongoDB 3.6 so we need to run following commands.

$ brew unlink mongodb

$ brew link --force mongodb@3.4  (--force required because it is a keg, which is it's a binary.)


Now when you are done with that project and need to again revert mongodb to latest version then you can use following commands to return back to original


$brew unlink mongodb@3.2


$brew link mongodb


Please let me know if you have any issues or queries regarding it.

Thanks.






No comments:

Post a Comment