(성능개선) MongoDB query (when choosing 11 list in each data for just one query)
* 몽고 디비 쿼리작업
db.getCollection('guestbookReply').aggregate([
{"$sort" : {regDt : 1}},
{"$match": {guestbookId : {"$in" :[ObjectId("58f6c9d49a72b291f14afe04"), ObjectId("58fde40e9a72b5cd0c88ae6e"),ObjectId("593fbb103b8baa7d5b6921c7")
,ObjectId("593fbb663b8bc590ac3f4799")]}}
},
{"$group" : {
"_id":"$guestbookId",
"GuestBookReply":{"$push" : "$$ROOT"}},
},
{"$project" : {
"GuestBookReply" : {"$slice" : ["$GuestBookReply",10]}
}}
]);
======================================================
db.getCollection('guestbookReply').aggregate([
//{"$sort" : {regDt : 1}},
{"$match": {guestbookId : {"$in" :[ObjectId("58f6c9d49a72b291f14afe04"), ObjectId("58fde40e9a72b5cd0c88ae6e"),ObjectId("593fbb103b8baa7d5b6921c7")
,ObjectId("593fbb663b8bc590ac3f4799")]}}
},
{"$group" : {
"_id":"$guestbookId",
"GuestBookReply":{"$push" : "$$ROOT"}},
},
{"$sort" : {"GuestBookReply.regDt" : 1}},
{"$project" : {
"GuestBookReply" : {"$slice" : ["$GuestBookReply",10]}
}}
]);
db.getCollection('guestbookReply').aggregate([
{"$sort" : {regDt : 1}},
{"$match": {guestbookId : {"$in" :[ObjectId("58f6c9d49a72b291f14afe04"), ObjectId("58fde40e9a72b5cd0c88ae6e"),ObjectId("593fbb103b8baa7d5b6921c7")
,ObjectId("593fbb663b8bc590ac3f4799")]}}
},
{"$group" : {
"_id":"$guestbookId",
"GuestBookReply":{"$push" : "$$ROOT"}},
},
{"$project" : {
"GuestBookReply" : {"$slice" : ["$GuestBookReply",10]}
}}
]);
======================================================
db.getCollection('guestbookReply').aggregate([
//{"$sort" : {regDt : 1}},
{"$match": {guestbookId : {"$in" :[ObjectId("58f6c9d49a72b291f14afe04"), ObjectId("58fde40e9a72b5cd0c88ae6e"),ObjectId("593fbb103b8baa7d5b6921c7")
,ObjectId("593fbb663b8bc590ac3f4799")]}}
},
{"$group" : {
"_id":"$guestbookId",
"GuestBookReply":{"$push" : "$$ROOT"}},
},
{"$sort" : {"GuestBookReply.regDt" : 1}},
{"$project" : {
"GuestBookReply" : {"$slice" : ["$GuestBookReply",10]}
}}
]);
댓글
댓글 쓰기