Polarcraft/web/server/api/store/index.get.js
Xeovalyte 8121b9b975
Some checks failed
Build and Deploy / Deploy Web (push) Has been cancelled
Build and Deploy / Deploy Discord Bot (push) Has been cancelled
Lots of improvements and changes
2023-05-27 12:02:33 +02:00

22 lines
379 B
JavaScript

export default defineEventHandler(async () => {
const storesColl = db.collection('stores');
const cursor = storesColl.aggregate([
{
$lookup:
{
from: "users",
localField: "ownerId",
foreignField: "_id",
as: "owner",
},
},
{
$unwind: "$owner",
},
])
return await cursor.toArray()
});