coyotte508's picture
coyotte508 HF staff
✨ Load pictures
fa79853
raw
history blame
443 Bytes
import type { User } from '$lib/types/User';
import type { Collection, Db, MongoClient } from 'mongodb';
export function createUserCollection(db: Db, client: MongoClient): Collection<User> {
const coll = db.collection<User>('users');
client.on('open', () => {
coll
.createIndex(
{
email: 1
},
{
collation: {
locale: 'en',
strength: 1
}
}
)
.catch(console.error);
});
return coll;
}