Skip to content

Commit

Permalink
Merge branch 'main' into feat/3005-workflow-execution-logs-ux
Browse files Browse the repository at this point in the history
  • Loading branch information
talboren authored Jan 13, 2025
2 parents da167f9 + 18d31fd commit a43d697
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
21 changes: 21 additions & 0 deletions examples/workflows/query_mongo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
id: query-mongodb
name: Query MongoDB
description: Querying MongoDB

triggers:
- type: manual
steps:
- name: mongodb-step
provider:
config: '{{ providers.mongo }}'
type: mongodb
with:
# Please note that argument order is important for MongoDB queries.
query: |
{
"find": "mycollection",
"filter": {
"name": "First Document"
}
}
single_row: true
3 changes: 3 additions & 0 deletions keep/providers/mongodb_provider/mongodb_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ def _query(
Returns:
list | tuple: list of results or single result if single_row is True
"""
if type(query) is str:
query = json.loads(query)

client = self.__generate_client()
database = client[self.authentication_config.database]
results = list(database.cursor_command(query))
Expand Down

0 comments on commit a43d697

Please sign in to comment.