Skip to content

Commit 52c98f3

Browse files
committed
replace deprecated mongo db.collection_names() with db.list_collection_names()
1 parent 7099049 commit 52c98f3

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

atomate/utils/testing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def tearDown(self):
8585
if hasattr(self, "lp"):
8686
self.lp.reset("", require_password=False)
8787
db = self.get_task_database()
88-
for coll in db.collection_names():
88+
for coll in db.list_collection_names():
8989
if coll != "system.indexes":
9090
db[coll].drop()
9191
shutil.rmtree(self.scratch_dir)

atomate/vasp/builders/boltztrap_materials.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def from_file(cls, db_file, m="materials", b="boltztrap", **kwargs):
153153
db_write = get_database(db_file, admin=True)
154154
try:
155155
db_read = get_database(db_file, admin=False)
156-
db_read.collection_names() # throw error if auth failed
156+
db_read.list_collection_names() # throw error if auth failed
157157
except Exception:
158158
print("Warning: could not get read-only database")
159159
db_read = get_database(db_file, admin=True)

atomate/vasp/builders/tags.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def from_file(cls, db_file, m="materials", t="tasks", **kwargs):
114114
db_write = get_database(db_file, admin=True)
115115
try:
116116
db_read = get_database(db_file, admin=False)
117-
db_read.collection_names() # throw error if auth failed
117+
db_read.list_collection_names() # throw error if auth failed
118118
except Exception:
119119
print("Warning: could not get read-only database; using write creds")
120120
db_read = get_database(db_file, admin=True)

atomate/vasp/builders/tasks_materials.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def from_file(cls, db_file, m="materials", c="counter", t="tasks", **kwargs):
141141
db_write = get_database(db_file, admin=True)
142142
try:
143143
db_read = get_database(db_file, admin=False)
144-
db_read.collection_names() # throw error if auth failed
144+
db_read.list_collection_names() # throw error if auth failed
145145
except Exception:
146146
logger.warning(
147147
"Warning: could not get read-only database; using write creds"

atomate/vasp/firetasks/tests/test_lobster_tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def tearDown(self):
9797
# remove the collections if needed and if possible
9898
try:
9999
db = self.get_task_database()
100-
for coll in db.collection_names():
100+
for coll in db.list_collection_names():
101101
if coll != "system.indexes":
102102
db[coll].drop()
103103
except Exception:

0 commit comments

Comments
 (0)