Downloads of v 4.4.2-rc0:


Last Update:

29 Oct 2020

Package Maintainer(s):

Software Author(s):

  • MongoDB Inc


cli database nosql

MongoDB (Portable)

This is a prerelease version of MongoDB (Portable).

4.4.2-rc0 | Updated: 29 Oct 2020



Downloads of v 4.4.2-rc0:



Software Author(s):

  • MongoDB Inc

MongoDB (Portable) 4.4.2-rc0

This is a prerelease version of MongoDB (Portable).

All Checks are Passing

2 Passing Test

Validation Testing Passed

Verification Testing Passed


To install MongoDB (Portable), run the following command from the command line or from PowerShell:


To upgrade MongoDB (Portable), run the following command from the command line or from PowerShell:


To uninstall MongoDB (Portable), run the following command from the command line or from PowerShell:


NOTE: This applies to both open source and commercial editions of Chocolatey.

1. Ensure you are set for organizational deployment

Please see the organizational deployment guide

  • Open Source or Commercial:
    • Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
    • You can also just download the package and push it to a repository Download

3. Enter your internal repository url

(this should look similar to

4. Choose your deployment method:

choco upgrade mongodb.portable -y --source="'STEP 3 URL'" [other options]

See options you can pass to upgrade.

See best practices for scripting.

Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.

If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:

choco upgrade mongodb.portable -y --source="'STEP 3 URL'"

Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
  Exit 0

Exit $exitCode

- name: Ensure mongodb.portable installed
    name: mongodb.portable
    state: present
    version: 4.4.2-rc0
    source: STEP 3 URL

See docs at

Coming early 2020! Central Managment Reporting available now! More information...

chocolatey_package 'mongodb.portable' do
  action    :install
  version  '4.4.2-rc0'
  source   'STEP 3 URL'

See docs at

    Name: mongodb.portable,
    Version: 4.4.2-rc0,
    Source: STEP 3 URL

Requires Otter Chocolatey Extension. See docs at

cChocoPackageInstaller mongodb.portable
   Name     = 'mongodb.portable'
   Ensure   = 'Present'
   Version  = '4.4.2-rc0'
   Source   = 'STEP 3 URL'

Requires cChoco DSC Resource. See docs at

package { 'mongodb.portable':
  provider => 'chocolatey',
  ensure   => '4.4.2-rc0',
  source   => 'STEP 3 URL',

Requires Puppet Chocolatey Provider module. See docs at

salt '*' chocolatey.install mongodb.portable version="4.4.2-rc0" source="STEP 3 URL"

See docs at

5. If applicable - Chocolatey configuration/installation

See infrastructure management matrix for Chocolatey configuration elements and examples.

Private CDN cached downloads available for licensed customers. Never experience 404 breakages again! Learn more...

This package is likely a meta/virtual (*) or an installer (*.install) or portable (*.portable) application package.

  • Meta/virtual (*) - has a dependency on the *.install or the *.portable package - it is provided for discoverability and for other packages to take a dependency on.
  • Portable (*.portable/*.commandline (deprecated naming convention)/*.tool (deprecated naming convention)) - usually zips or archives that require no administrative access to install.
  • Install (*.install/*.app (deprecated naming convention)) - uses native installers, usually requires administrative access to install.

Learn more about chocolatey's distinction of installed versus portable apps and/or learn about this kind of package.

This package was approved as a trusted package on 29 Oct 2020.


MongoDB (from "humongous") is a scalable, high-performance, open source NoSQL database written in C++.

MongoDB stores data using a flexible document data model that is similar to JSON. Documents contain one or more fields, including arrays, binary data and sub-documents. Fields can vary from document to document. This flexibility allows development teams to evolve the data model rapidly as their application requirements change.

Developers access documents through rich, idiomatic drivers available in all popular programming languages. Documents map naturally to the objects in modern languages, which allows developers to be extremely productive. Typically, there’s no need for an ORM layer.

Package Parameters

The following package parameters can be set:

  • /installDir: - set the installation directory of MongoDB - defaults to "$env:ChocolateyToolsLocation" A new folder "mongodb" will be created in that folder

To pass parameters, use --params "''" (e.g. choco install packageID [other options] --params="'/ITEM:value /ITEM2:value2 /FLAG_BOOLEAN'").
To have choco remember parameters on upgrade, be sure to set choco feature enable -n=useRememberedArgumentsForUpgrades.

Please Note: This is an automatically updated package. If you find it is
out of date by more than a day or two, please contact the maintainer(s) and
let them know the package is no longer updating correctly.

$ErrorActionPreference = 'Stop';
$url64          = ''
$checksum64     = 'a094dd517e1a133583314aca327b63e26c4866de8259261bbc7bc1f558d254a4'
$checksumType64 = 'sha256'

$binRoot = Get-ToolsLocation

$pp = Get-PackageParameters
if ($pp.installDir) {
  Write-Debug "Override installDir."
  $binRoot = $pp.installDir

$packageName = 'mongodb'

$installDir = Join-Path $binRoot "$packageName"
$installDirBin = "$($installDir)\current\bin"
Write-Host "Adding `'$installDirBin`' to the path and the current shell path"
Install-ChocolateyPath "$installDirBin"
$env:Path = "$($env:Path);$($installDirBin)"

if (![System.IO.Directory]::Exists($installDir)) {[System.IO.Directory]::CreateDirectory($installDir) | Out-Null}

$packageArgs = @{
  packageName    = $env:ChocolateyPackageName
  unzipLocation  = $installDir
  url64bit      = $url64
  checksum64    = $checksum64
  checksumType64= $checksumType64

Install-ChocolateyZipPackage  @packageArgs

# find the unpack directory
$installedContentsDir = Get-ChildItem $installDir -include 'mongodb*' | Sort-Object -Property LastWriteTime -Desc | Select-Object -First 1

# delete current bin directory contents
if ([System.IO.Directory]::Exists("$installDirBin")) {
  Write-Host "Clearing out the contents of `'$installDirBin`'."
  Start-Sleep 3

# copy the installed directory into the current dir
Write-host "Copying contents of `'$installedContentsDir`' to `'$($installDir)\current`'."
[System.IO.Directory]::CreateDirectory("$installDirBin") | Out-Null
Copy-Item "$($installedContentsDir)\*" "$($installDir)\current" -Force -Recurse

# setup mongo working dirs
$dataDir = Join-Path $installDir 'data'
if (!$(Test-Path $dataDir)) {mkdir $dataDir}
$logDir = Join-Path $installDir 'log'
if (!$(Test-Path $logDir)){mkdir $logDir}

# create batch files
$exeFile = Join-Path $installDirBin 'mongo.exe'
$batchFile = Join-Path $installDirBin 'mongo.bat'
"@echo off
$exeFile %*" | Out-File $batchFile -encoding ASCII
$batchFile = Join-Path $installDirBin 'mongorotatelogs.bat'
"@echo off
$exeFile --eval `'db.runCommand(`"logRotate`")`' mongohost:27017/admin" | Out-File $batchFile -encoding ASCII

$exeFile = Join-Path $installDirBin 'mongod.exe'
$batchFile = Join-Path $installDirBin 'start-mongodb.bat'
$logFile = Join-Path $logDir "MongoDB.log"
"@echo off
$exeFile --quiet --bind_ip --logpath $logFile --logappend --dbpath $dataDir --directoryperdb" | Out-File $batchFile -encoding ASCII

# start mongodb
Start-Process "$batchFile"
$packageName = 'mongodb'
$toolsPath = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$unPath = Join-Path $toolsPath 'Uninstall-ChocolateyPath.psm1'

Write-Verbose "Default install location is `'$env:ChocolateyToolsLocation`'"
$binRoot = Get-ToolsLocation
$installDir = Join-Path $binRoot "$packageName"
$installDirBin = "$($installDir)\current\bin"
if (Test-Path $installDirBin) {
  Remove-Item $installDirBin -Recurse -Force

Write-Verbose "Removing from path..."
Import-Module $unPath
Uninstall-ChocolateyPath $installDirBin
function Uninstall-ChocolateyPath {
  [string] $pathToUninstall,
  [System.EnvironmentVariableTarget] $pathType = [System.EnvironmentVariableTarget]::User
  Write-Debug "Running 'Uninstall-ChocolateyPath' with pathToUninstall:`'$pathToUninstall`'";

  #get the PATH variable
  $envPath = $env:PATH
  #$envPath = [Environment]::GetEnvironmentVariable('Path', $pathType)
  if (!$envPath.ToLower().Contains($pathToUninstall.ToLower())) {
    Write-Host "PATH environment variable does not have $pathToUninstall in it."

  Write-Host "PATH environment variable has $pathToUninstall in it. Removing..."
  $actualPath = [Environment]::GetEnvironmentVariable('Path', $pathType)

  # escape regex metachars, match possible backslash and item separator at eol
  $pathToUninstallRegex = ($pathToUninstall -replace '([\\().])', '\$1') + '\\?(;|$)'

  # remove pathToUninstall from actualPath
  $actualPath = $actualPath -replace "$pathToUninstallRegex", ''

  if ($pathType -eq [System.EnvironmentVariableTarget]::Machine) {
    $psArgs = "[Environment]::SetEnvironmentVariable('Path',`'$actualPath`', `'$pathType`')"
    Start-ChocolateyProcessAsAdmin "$psArgs"
  } else {
    [Environment]::SetEnvironmentVariable('Path', $actualPath, $pathType)

  # remove from path of current powershell session
  $envPSPath = $env:PATH
  $env:Path = $envPSPath -replace "$pathToUninstallRegex", ''

Log in or click on link to see number of positives.

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Version Downloads Last Updated Status
MongoDB (Portable) 4.4.2-rc0 5 Thursday, October 29, 2020 Approved
MongoDB (Portable) 4.4.1-rc3 17 Wednesday, September 2, 2020 Exempted
MongoDB (Portable) 4.4.1-rc2 10 Thursday, August 27, 2020 Exempted
MongoDB (Portable) 4.4.1-rc1 22 Tuesday, August 25, 2020 Exempted
MongoDB (Portable) 4.4.1-rc0 17 Saturday, August 22, 2020 Exempted
MongoDB (Portable) 4.4.0 102 Saturday, August 1, 2020 Approved
MongoDB (Portable) 4.2.8 167 Tuesday, June 16, 2020 Approved
MongoDB (Portable) 4.2.7 58 Monday, May 25, 2020 Approved
MongoDB (Portable) 4.2.6 103 Monday, April 20, 2020 Approved

Discussion for the MongoDB (Portable) Package

Ground Rules:

  • This discussion is only about MongoDB (Portable) and the MongoDB (Portable) package. If you have feedback for Chocolatey, please contact the Google Group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or MongoDB (Portable), or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.
comments powered by Disqus