Polarcraft/web/server/api/store/index.get.js

22 lines
379 B
JavaScript
Raw Normal View History

2023-05-27 12:02:33 +02:00
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()
});