Answer the question
In order to leave comments, you need to log in
How to calculate sum of array elements in mongoose?
In general, you need to create a pharmacy, and there are 4 models, medicines, customers, pharmacy and medicine categories.
In the cart, you need to count the sum of all the goods that are in the cart
const basketSchema = mongoose.Schema({
user: {
ref: "Client",
type: mongoose.Schema.Types.ObjectId
},
product: {
ref: "Drug",
type: mongoose.Schema.Types.ObjectId,
total: temp + Drug.product
}
})
users
.aggregate([
{
$lookup: {
from: 'rooms',
localField: 'room_id',
foreignField: 'id',
as: 'room_details',
},
},
])
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question