Skip to content

Instantly share code, notes, and snippets.

View p-lurd's full-sized avatar

OBAYORI Jedidiah p-lurd

View GitHub Profile
@p-lurd
p-lurd / DbQuery.ts
Created November 1, 2025 09:45
One of the aggregation query I used
async findMany(id: string) {
try {
const data = await Model.aggregate([
{ $match: { businessId: new mongoose.Types.ObjectId(id) } },
{ $addFields: {
dateString: { $dateToString: { format: "%Y-%m-%d", date: "$createdAt" } }
}
},