Skip to content

mongodb get-document

Get mongodb document

Description

Get the document with given ID in given collection

Synopsis

mongodb get-document
    [--site <site>]
    <database>
    <collection>
    <Index>

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 of the document
     Example: "Index-1"
     Default: _None_      Attributes: required

Examples

Input:

! mongodb get-document "test-database-1" "test-collection-1" "{\"sample\":\"document\"}"
Output:
[{_id ObjectID(\"621785023620990be3cc378d\")} {sample document} {sample2 1}]

Access Control

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

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

Please see Access Control for details.