diff --git a/images/win/scripts/Installers/Install-MongoDB.ps1 b/images/win/scripts/Installers/Install-MongoDB.ps1 index ce73fe5a2..d82342450 100644 --- a/images/win/scripts/Installers/Install-MongoDB.ps1 +++ b/images/win/scripts/Installers/Install-MongoDB.ps1 @@ -5,8 +5,25 @@ # Install mongodb package $toolsetVersion = (Get-ToolsetContent).mongodb.version -$latestChocoPackage = Get-LatestChocoPackageVersion -TargetVersion $toolsetVersion -PackageName "mongodb" -Choco-Install -PackageName mongodb -ArgumentList "--version=$latestChocoPackage" + +$getMongoReleases = Invoke-WebRequest -Uri "https://www.mongodb.com/docs/upcoming/release-notes/$toolsetVersion" -UseBasicParsing +$TargetReleases = $getMongoReleases.Links.href | Where-Object {$_ -like "*std-label-$toolsetVersion*"} + +$MinorVersions = @() +foreach ($release in $TargetReleases) { + $pattern = '\d+\.\d+\.\d+' + $version = $release | Select-String -Pattern $pattern -AllMatches | ForEach-Object { $_.Matches } | ForEach-Object { $_.Value } + $MinorVersions += $version + } + +$LatestVersion = $MinorVersions[0] + +$installDir = "c:\PROGRA~1\MongoDB" +$binaryName = "mongodb-windows-x86_64-$LatestVersion-signed.msi" +$downloadURL = "https://fastdl.mongodb.org/windows/$BinaryName" +$installArg = "INSTALLLOCATION=$installDir ADDLOCAL=all" +Install-Binary -Url $downloadURL -Name $binaryName -ArgumentList ("/q","/i","${env:Temp}\$binaryName", $installArg) + # Add mongodb to the PATH $mongodbService = "mongodb" diff --git a/images/win/toolsets/toolset-2019.json b/images/win/toolsets/toolset-2019.json index ccec4dc93..64ef60915 100644 --- a/images/win/toolsets/toolset-2019.json +++ b/images/win/toolsets/toolset-2019.json @@ -469,7 +469,7 @@ "version": "5.7" }, "mongodb": { - "version": "5.0.15" + "version": "5.0" }, "nsis": { "version": "3.08" diff --git a/images/win/toolsets/toolset-2022.json b/images/win/toolsets/toolset-2022.json index 959e5a894..5782aa381 100644 --- a/images/win/toolsets/toolset-2022.json +++ b/images/win/toolsets/toolset-2022.json @@ -401,7 +401,7 @@ "version": "8.0" }, "mongodb": { - "version": "5.0.15" + "version": "5.0" }, "nsis": { "version": "3.08"