Skip to content

Commit

Permalink
style(mongodb): format using ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
KadeRyu committed Jan 23, 2025
1 parent 6d70e90 commit 2ba5b69
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions metadata-ingestion/src/datahub/ingestion/source/mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,13 @@ def construct_schema_pymongo(
if should_add_document_size_filter:
doc_size_field = "temporary_doc_size_field"
# create a temporary field to store the size of the document. filter on it and then remove it.
aggregations.extend([
{"$addFields": {doc_size_field: {"$bsonSize": "$$ROOT"}}},
{"$match": {doc_size_field: {"$lt": max_document_size}}},
{"$project": {doc_size_field: 0}},
])
aggregations.extend(
[
{"$addFields": {doc_size_field: {"$bsonSize": "$$ROOT"}}},
{"$match": {doc_size_field: {"$lt": max_document_size}}},
{"$project": {doc_size_field: 0}},
]
)

documents = collection.aggregate(aggregations, allowDiskUse=True)

Expand Down

0 comments on commit 2ba5b69

Please sign in to comment.