< Back
Remove-MdbcData
Post
NAME Remove-MdbcData
SYNOPSIS
Removes documents from collections.
SYNTAX
Remove-MdbcData [[-Filter] <Object>] [-Collection <IMongoCollection`1>] [-Session <IClientSessionHandle>] [-Many]
[-Result] [<CommonParameters>]
DESCRIPTION
This cmdlet removes the specified documents.
With pipeline input, documents are found by input document _id's, without using parameters Filter and Many:
... | Remove-MdbcData
Otherwise, documents are specified by Filter with optional Many:
Remove-MdbcData [-Filter] <filter> [-Many]
In order to output the result info use the switch Result.
Depending on operations and settings some server exceptions are caught and written as not terminating errors, i.e.
processing continues.
Parameters ErrorAction and variables $ErrorActionPreference are used to alter error actions. See help
about_CommonParameters and about_Preference_Variables.
PARAMETERS
-Filter
Specifies the documents to be removed. The argument is either JSON or similar dictionary. The parameter is
mandatory unless documents with _id come from the pipeline. It does not accept nulls. To remove all, use an
empty filter (@{}, '{}') and Many.
Required? false
Position? 0
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters?
-Collection
Collection instance. If it is omitted then the variable $Collection is used. It is obtained by Connect-Mdbc,
Get-MdbcCollection, or using the driver API.
Required? false
Position? named
Default value
Accept pipeline input?
Accept wildcard characters?
-Many
Tells to remove all matching documents. By default the first matching document is removed. The parameter is
not used if the documents come from the pipeline.
Required? false
Position? named
Default value
Accept pipeline input?
Accept wildcard characters?
-Result
Tells to output the operation result info.
Required? false
Position? named
Default value
Accept pipeline input?
Accept wildcard characters?
-Session
Specifies the client session which invokes the command.
If it is omitted then the cmdlet is invoked in the current default session, either its own or the transaction
session created by Use-MdbcTransaction.
Required? false
Position? named
Default value
Accept pipeline input?
Accept wildcard characters?
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
[MongoDB.Driver.DeleteResult]
Returned if the Result is specified. Useful members: DeletedCount.
RELATED LINKS
Connect-Mdbc
SYNOPSIS
Removes documents from collections.
SYNTAX
Remove-MdbcData [[-Filter] <Object>] [-Collection <IMongoCollection`1>] [-Session <IClientSessionHandle>] [-Many]
[-Result] [<CommonParameters>]
DESCRIPTION
This cmdlet removes the specified documents.
With pipeline input, documents are found by input document _id's, without using parameters Filter and Many:
... | Remove-MdbcData
Otherwise, documents are specified by Filter with optional Many:
Remove-MdbcData [-Filter] <filter> [-Many]
In order to output the result info use the switch Result.
Depending on operations and settings some server exceptions are caught and written as not terminating errors, i.e.
processing continues.
Parameters ErrorAction and variables $ErrorActionPreference are used to alter error actions. See help
about_CommonParameters and about_Preference_Variables.
PARAMETERS
-Filter
Specifies the documents to be removed. The argument is either JSON or similar dictionary. The parameter is
mandatory unless documents with _id come from the pipeline. It does not accept nulls. To remove all, use an
empty filter (@{}, '{}') and Many.
Required? false
Position? 0
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters?
-Collection
Collection instance. If it is omitted then the variable $Collection is used. It is obtained by Connect-Mdbc,
Get-MdbcCollection, or using the driver API.
Required? false
Position? named
Default value
Accept pipeline input?
Accept wildcard characters?
-Many
Tells to remove all matching documents. By default the first matching document is removed. The parameter is
not used if the documents come from the pipeline.
Required? false
Position? named
Default value
Accept pipeline input?
Accept wildcard characters?
-Result
Tells to output the operation result info.
Required? false
Position? named
Default value
Accept pipeline input?
Accept wildcard characters?
-Session
Specifies the client session which invokes the command.
If it is omitted then the cmdlet is invoked in the current default session, either its own or the transaction
session created by Use-MdbcTransaction.
Required? false
Position? named
Default value
Accept pipeline input?
Accept wildcard characters?
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
[MongoDB.Driver.DeleteResult]
Returned if the Result is specified. Useful members: DeletedCount.
RELATED LINKS
Connect-Mdbc