Skip to content

Commit fd54823

Browse files
committed
chore: change shared to delete instead of drop
1 parent 45863cd commit fd54823

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ secrets-export.fish
103103
mo-expansion.sh
104104
mo-expansion.yml
105105
expansions.sh
106+
uri.txt
106107

107108
.drivers-tools/
108109

test/integration/shared.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,13 @@ async function setupDatabase(configuration, dbsToClean) {
9696

9797
dbsToClean.push(configDbName);
9898

99-
const client = configuration.newClient(configuration.writeConcernMax());
99+
const client = configuration.newClient();
100100
try {
101101
for (const dbName of dbsToClean) {
102-
await client
103-
.db(dbName)
104-
.command({ dropAllUsersFromDatabase: 1, writeConcern: { w: 'majority' } });
105-
try {
106-
await client.db(dbName).dropDatabase({ writeConcern: { w: 'majority' } });
107-
} catch (error) {
108-
if (!error.message.match(/database is currently being dropped/)) throw error;
102+
const db = await client.db(dbName);
103+
for await (const { name } of db.listCollections({}, { nameOnly: true })) {
104+
const collection = db.collection(name);
105+
await collection.deleteMany({});
109106
}
110107
}
111108
} finally {

0 commit comments

Comments
 (0)