[ad_1]
I’m trying to run script in mongodb at the beginning of cypress test. I’ve added method in plugins/index.js to connect to mongo but I’m not sure what to do next. I’ve try to add in taks db.command with script, but it doesn’t work. Any ideas, how I can do this ?
const { MongoClient } = require('mongodb')
const uri = "someUri"
if (!uri) {
throw new Error('Missing MONGO_URI')
}
const client = new MongoClient(uri)
async function connect() {
await client.connect()
return client.db()
}
module.exports = async (on, config) => {
const db = await connect()
on('task', {
};
[ad_2]