Remove-MongoDB Cmdlet
Deletes MongoDB data.
Syntax
Remove-MongoDB [parameters]
Remarks
The Remove-MongoDB cmdlet allows you to use a syntax similar to SQL DELETE statements to delete MongoDB data.
$conn = Connect-MongoDB -Server '127.0.0.1' -Port 27017 -Database 'test' -User 'test' -Password 'test' Remove-MongoDB -Connection $conn -Table "[CData].[Sample].Customers" -Id "22"The Where parameter can also be used to specify the primary key:
Remove-MongoDB -Connection $conn -Table "exTablePowershell;" -Where "_id = 22"The primary key can also be passed to the cmdlet along the pipeline:
Select-MongoDB -Connection $conn -Table [CData].[Sample].Customers -Where "Country = 'US'" | Remove-MongoDB