$unwind এবং $project ব্যবহার করে অ্যারেতে থেকে নির্দিষ্ট ফিল্ড প্রজেক্ট করুন। বাদ দিতে ফিল্ডের মান ০ সেট করুন।
> db.demo731.insertOne({ "ProductInformation": [ { ProductId:"Product-1", ProductPrice:80 }, { ProductId:"Product-2", ProductPrice:45 }, { ProductId:"Product-3", ProductPrice:50 } ] });
এগ্রিগেশন কোয়েরি (ProductPrice=80 ফিল্টার, ProductPrice বাদ দিয়ে):
> db.demo731.aggregate([
{ $unwind: "$ProductInformation" },
{ $match: { "ProductInformation.ProductPrice": 80 } },
{ $project: {_id: 0, "ProductInformation.ProductPrice":0 } }
])
আউটপুট: { "ProductInformation" : { "ProductId" : "Product-1" } }