Here is a screenshot of my collection:
Here is my query:
db.collection("collection_name").aggregate(
[
{$match:
{br_date: this.data.date}
}
]).toArray()
And, this is what I get
_id: id,
brdate: 10-08-2022
brName: "Principal Branch, Dhaka",
email: "example_email,
loans: [
[
{loan_id: 1, loan_name: X, category: "rural"},
{loan_id: 2, loan_name: Y, category: "urban"},
{loan_id: 3, loan_name: Z, category: "rural"}
],
[
{loan_id: 4, loan_name: A, category: "rural"},
{loan_id: 5, loan_name: B, category: "urban"}
],
]
Question 1: I would like to show the loans depending on their category. Let's say, I would like to show the loans that are from "rural" category. How do I do that?
Question 2: I may have to delete a loan that matches the loan_id. How do I do that?
Question 3: I may have to update a loan that matches the loan_id. How do I do that?
