Skip to content

mongodb update-document

Update mongodb Document

Description

Update the document with given ID

Synopsis

mongodb update-document
    [--site <site>]
    <database>
    <collection>
    <index>
    <update>

Arguments

site - (string)

     Site where this command will be executed
     Example: --site "site-1"
     Default: input.site      Attributes: optional

database - (string)

     Name of the database
     Example: "database-1"
     Default: _None_      Attributes: required

collection - (string)

     Name of the collection
     Example: "collection-1"
     Default: _None_      Attributes: required

index - (string)

     Index value to ID the target document
     Example: "index-1"
     Default: _None_      Attributes: required

update - (string)

     Values to be updated
     Example: "update-1"
     Default: _None_      Attributes: required

Examples

Input:

! mongodb update-document "test-database-1" "test-collection-1" "{\"sample\":\"document\"}" "{\"sample\":\"document\", \"sample2\":4351}"
Output:
Matched and replaced an existing document

Access Control

To use this command, you need access to the following:

Field Value
Action "update"
Service Type "mongodb"
Service Instance
Namespace
Object Type "document"
Object ID document

Please see Access Control for details.