We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 63f0c56 commit 299003dCopy full SHA for 299003d
app/api/[roomcode]/delete/route.ts
@@ -4,17 +4,9 @@ import clientPromise from '@/utils/newdb'
4
export async function DELETE(_request: Request, context: RoomCodeRouteContext) {
5
try {
6
const client = await clientPromise
7
- const db = client.db('get_interval')
+ const db = client.db('get_interval');
8
9
- const rooms = await db
10
- .collection('rooms')
11
- .find({ roomcode: context.params.roomcode })
12
- .limit(10)
13
- .toArray()
14
-
15
- for (let i = 0; i < rooms.length; i++) {
16
- db.collection('rooms').findOneAndDelete({ _id: rooms[i]._id })
17
- }
+ db.collection('rooms').deleteMany({ roomcode: context.params.roomcode })
18
19
return new Response(JSON.stringify(''), { status: 200 })
20
} catch (error) {
0 commit comments