-
Notifications
You must be signed in to change notification settings - Fork 0
/
API-lists.txt
71 lines (54 loc) · 1.56 KB
/
API-lists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
1.ProdutController-Done.
2.Get Produts-Done.
3.Add a product-Done.
4.Get one product-Done.
5.Filter product - Done.
6.Rate Produt- Done.
7.Add item in cart - Done
8.Get item in cart - Done
9.Remove item from cart.Done
UserConteroller
SignUp - Email, Name, Password, Type Of User ( Customer, Seller ).- Done
SignIn - Email and Password - Done
Auth
basicAuth - Done
JWT Auth - Done
iD // ---> changing ro givibnd id to users and products in mongoDb - Done
1. Counter Collection (id:"cartItemId", value:0)
2. while adding cart items , increment the counter and use counter value as id to cartItem document.
{_id: cat1,
avgPrice: 50000}
2. Find the avg rating of the product.
-> pipeline
db.products.aggregate([
// 1. Create a documents for ratings
{
$unwind:"$ratings"
},
// 2. Group rating and get the AvgRating
{
$group:{
_id:"$name",
averageRating: {$avg:"$ratings.rating"}
}
}
])
/// learn new rhing in mongoDb
db.products.aggregate([
//1.PRoejct name of Produt and the countOfRating
{
$project:{name:1, countOfRating:{
$cond: {if:{$isArray: "$ratings"},
then:{ $size:"$ratings"}, else:0}
}
//2. Sorting the items products
}
},
{
$sort : {"countOfRating":-1}
},
{
//3. Limit to just 1 item in result.
$limit:1
}
])