(성능개선) 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]}
     }}
]);

댓글

이 블로그의 인기 게시물

(18장) WebSocekt과 STOMP를 사용하여 메시징하기

(네트워크)폴링방식 vs 롱 폴링방식

(ElasticSearch) 결과에서 순서 정렬