Skip to content

Commit 7fb57f0

Browse files
author
Jib
committed
create collections when empty
1 parent 3a57e93 commit 7fb57f0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.evergreen/scaffold_atlas.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ def upload_data(db: Database, filename: Path) -> None:
4141
)
4242
if not isinstance(loaded_collection, list):
4343
loaded_collection = [loaded_collection]
44-
result: InsertManyResult = db[collection_name].insert_many(loaded_collection)
45-
logger.debug("Uploaded results for %s: %s", filename.name, result.inserted_ids)
44+
if loaded_collection:
45+
result: InsertManyResult = db[collection_name].insert_many(loaded_collection)
46+
logger.debug("Uploaded results for %s: %s", filename.name, result.inserted_ids)
47+
else:
48+
logger.debug("Empty collection named %s created", collection_name)
49+
db.create_collection(collection_name)
4650

4751

4852
def walk_collection_directory() -> list[str]:

0 commit comments

Comments
 (0)