< Back

Update-MdbcData

Sat Jan 18, 2020 11:33 am

NAME Update-MdbcData



SYNOPSIS

Updates documents in collections.





SYNTAX

Update-MdbcData [[-Filter] <Object>] [-Update] <Object> [-Collection <IMongoCollection`1>] [-Options

<UpdateOptions>] [-Session <IClientSessionHandle>] [-Add] [-Many] [-Result] [<CommonParameters>]





DESCRIPTION

Applies the specified Update to documents matching the specified Filter.



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 document(s) to be processed. The argument is either JSON or similar dictionary.



The parameter is mandatory and does not accept nulls. In order to specify all documents use an empty filter,

e.g. @{}.



Required? false

Position? 0

Default value

Accept pipeline input?

Accept wildcard characters?



-Update

Specifies the update expression. The argument is JSON, similar dictionary, or array for aggregate expressions.



The parameter is mandatory and does not accept nulls.



Required? true

Position? 1

Default value

Accept pipeline input?

Accept wildcard characters?



-Add

Tells to add a document based on the filter and update if nothing was updated.



Required? false

Position? named

Default value

Accept pipeline input?

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 update all matching documents. By default the first matching document is updated.



Required? false

Position? named

Default value

Accept pipeline input?

Accept wildcard characters?



-Options

Extra options, see MongoDB.Driver.UpdateOptions



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.UpdateResult]

Returned if Result is specified. Useful members: MatchedCount, ModifiedCount, UpsertedId.







RELATED LINKS

Connect-Mdbc

Update-MdbcData