Lo que funcionó para mí fue:
async function getByName(name) { try { const query = { username: { '$regex': `^${name}$`, '$options': 'i' }} const user = await collection.findOne(query); return user; } catch (err) { throw err; } }Puede reemplazar el "findOne()" con un "find.
Escribe tus pensamientos.