Mdbc
MongoDB Cmdlets for PowerShell Core 7.4
The PowerShell module based on the official MongoDB C# driver
Quick start
Step 1: Get and install Mdbc from the PSGallery:
Install-Module Mdbc
Step 2: Import the module:
Import-Module Mdbc
Step 3: See help and available commands:
help about_Mdbc
help Connect-Mdbc
Get-Command -Module Mdbc
Step 4: Make sure mongod is running and try some commands:
# Load the module
Import-Module Mdbc
# Connect the new collection test.test
Connect-Mdbc . test test -NewCollection
# Add two documents
@{_id = 1; value = 42}, @{_id = 2; value = 3.14} | Add-MdbcData
# Get documents as PS objects
Get-MdbcData -As PS | Format-Table
# Get the document by _id
Get-MdbcData @{_id = 1}
# Update the document, set 'value' to 100
Update-MdbcData @{_id = 1} @{'
…