MongoDB

The MongoDB component is a data component that allows users to access the MongoDB NoSQL database. It can carry out the following tasks:

#Release Stage

Alpha

#Configuration

The component definition and tasks are defined in the definition.yaml and tasks.yaml files respectively.

#Setup

In order to communicate with MongoDB, the following connection details need to be provided. You may specify them directly in a pipeline recipe as key-value pairs within the component's setup block, or you can create a Connection from the Integration Settings page and reference the whole setup as setup: ${connection.<my-connection-id>}.

FieldField IDTypeNote
URI (required)uristringFill in your MongoDB URI.

#Supported Tasks

#Insert

Perform an insert operation

InputField IDTypeDescription
Task ID (required)taskstringTASK_INSERT
Database Name (required)database-namestringThe name of the database in MongoDB.
Collection Name (required)collection-namestringThe name of the collection in MongoDB.
IDidstringThe ID of the document.
Data (required)dataobjectThe data to be inserted.
OutputField IDTypeDescription
StatusstatusstringInsert status.

#Insert Many

Perform an insert many operation

InputField IDTypeDescription
Task ID (required)taskstringTASK_INSERT_MANY
Database Name (required)database-namestringThe name of the database in MongoDB.
Collection Name (required)collection-namestringThe name of the collection in MongoDB.
Array IDarray-idarray[string]The array of id.
Data (required)array-dataarray[object]The array data to be inserted.
OutputField IDTypeDescription
StatusstatusstringInsert many status.

#Find

Perform a find operation

InputField IDTypeDescription
Task ID (required)taskstringTASK_FIND
Database Name (required)database-namestringThe name of the database in MongoDB.
Collection Name (required)collection-namestringThe name of the collection in MongoDB.
IDidstringThe ID of the document.
FilterfilterobjectThe filter to find documents, please refer to the documentations. If empty then all documents will be returned.
LimitlimitintegerThe number of documents to return. If empty then all documents will be returned.
Fieldsfieldsarray[string]The fields to return in the documents. If empty then all fields will be returned.
OutputField IDTypeDescription
ResultresultobjectResult of the find operation.
StatusstatusstringFind status.
Output Objects in Find

Result

FieldField IDTypeNote
MetadatadataarrayThe data returned from the find operation.
DocumentsdocumentsarrayThe documents returned from the find operation.
IDsidsarrayThe ids returned from the find operation.

#Update

Perform an update operation

InputField IDTypeDescription
Task ID (required)taskstringTASK_UPDATE
Database Name (required)database-namestringThe name of the database in MongoDB.
Collection Name (required)collection-namestringThe name of the collection in MongoDB.
IDidstringThe ID of the document.
FilterfilterobjectThe filter to update documents, please refer to the documentations. If empty then all documents will be returned.
Update (required)update-dataobjectThe updated data to be applied to the documents.
OutputField IDTypeDescription
StatusstatusstringUpdate status.

#Delete

Perform a delete operation

InputField IDTypeDescription
Task ID (required)taskstringTASK_DELETE
Database Name (required)database-namestringThe name of the database in MongoDB.
Collection Name (required)collection-namestringThe name of the collection in MongoDB.
IDidstringThe ID of the document.
FilterfilterobjectThe filter to delete documents, please refer to the documentations. If empty then all documents will be returned.
OutputField IDTypeDescription
StatusstatusstringDelete status.

#Drop Collection

Delete the collection

InputField IDTypeDescription
Task ID (required)taskstringTASK_DROP_COLLECTION
Database Name (required)database-namestringThe name of the database in MongoDB.
Collection Name (required)collection-namestringThe name of the collection in MongoDB.
OutputField IDTypeDescription
StatusstatusstringDelete collection status.

#Drop Database

Delete the database

InputField IDTypeDescription
Task ID (required)taskstringTASK_DROP_DATABASE
Database Name (required)database-namestringThe name of the database in MongoDB.
OutputField IDTypeDescription
StatusstatusstringDelete database status.

#Create Search Index

Create a search index, only works for M10 or larger clusters

InputField IDTypeDescription
Task ID (required)taskstringTASK_CREATE_SEARCH_INDEX
Database Name (required)database-namestringThe name of the database in MongoDB.
Collection Name (required)collection-namestringThe name of the collection in MongoDB.
Index Name (required)index-namestringThe name of the index to be created.
Index Type (required)index-typestringThe type of the index to be created.
Enum values
  • search
  • vectorSearch
Syntax (required)syntaxobjectThe syntax structure of the search index, please refer to the MongoDB documentation for more information. search here. vectorSearch here.
OutputField IDTypeDescription
StatusstatusstringCreate index status.

#Drop Search Index

Drop a search index, only works for M10 or larger clusters

InputField IDTypeDescription
Task ID (required)taskstringTASK_DROP_SEARCH_INDEX
Database Name (required)database-namestringThe name of the database in MongoDB.
Collection Name (required)collection-namestringThe name of the collection in MongoDB.
Index Name (required)index-namestringThe name of the index to be dropped.
OutputField IDTypeDescription
StatusstatusstringDelete index status.

Perform a vector search operation

InputField IDTypeDescription
Task ID (required)taskstringTASK_VECTOR_SEARCH
Database Name (required)database-namestringThe name of the database in MongoDB.
Collection Name (required)collection-namestringThe name of the collection in MongoDB.
Index Name (required)index-namestringThe name of the index to be used for vector search.
Query Vector (required)query-vectorarray[number]The query vector to be used for vector search.
ExactexactbooleanThe exact value for vector search. If true, then ENN search will be performed, otherwise ANN search will be performed. Default to false.
Limit (required)limitintegerLimit the documents to be returned.
Number of Candidatesnum-candidatesintegerThe number of candidates to the field to be used for vector search. Default to 3 times limit.
Path (required)pathstringThe path to the field to be used for vector search.
FilterfilterobjectThe filter to be used for vector search, need to first create filter vectorSearch search index, please refer to the documentations. If empty then all documents will be returned to be used for vector search.
Fieldsfieldsarray[string]The fields to return in the documents. If empty then all fields will be returned.
OutputField IDTypeDescription
ResultresultobjectResult of the vector search operation.
StatusstatusstringVector search status.
Output Objects in Vector Search

Result

FieldField IDTypeNote
DocumentsdocumentsarrayThe documents returned from the vector search operation.
IDsidsarrayThe ids returned from the vector search operation.
MetadatametadataarrayThe metadata returned from the vector search operation.
VectorsvectorsarrayThe vectors returned from the vector search operation.