db.orders.aggregate( [ { $match: { status: "A" } }, { $group: { _id: "$cust_id", total: { $sum: "$amount" } } }, { $sort: { total: -1 } }, { $limit: 2 } ], { cursor: { batchSize: 0 } } )batchSize:0 이면 데이터가 조회되는 즉시 리턴됨. 빠르게 첫번째 데이터를 가져올 수 있음
Aggregate 예제1보다 몽고쉘에서 수행하는 형태로 작성해 보기....new Document 방식 보다는 아래 방식이 더 비슷해 보입니다. MongoClient mongo = ~~~ 생략... MongoDatabase db = mongo.getDatabase("test"); // test db MongoCollection coll_trd = db.getCollection("tn_trade"); AggregateIterable res_doc = coll_trd.aggregate ( Arrays.asList( Aggregates.match( Filters.gte("price", 50000) ), Aggregates.group("$prdt_nm", sum("tot_sum", "$price") ) )); f..
MongoClient mongo = ~~~ 생략... MongoDatabase db = mongo.getDatabase("test"); // test db MongoCollection coll_trd = db.getCollection("tn_trade"); AggregateIterable res_doc = coll_trd.aggregate ( Arrays.asList( new Document("$match", new Document("price", new Document("$gte", 50000))), new Document("$group", new Document("_id", "$prdt_nm") .append("trd_sum", new Document("$sum", "$price")) )); for(..
- Total
- Today
- Yesterday
- 홈 오피스
- 증권정보포털
- 르세라핌
- Sybase IQ
- GKRS
- 빈센트 반 고흐
- Life Chair
- 별잉 빛나는 밤
- 로니카 BCS
- 오미크론
- yugabyteDB
- JMW 헤어드라이기기
- 파나소닉 비데 DL-EH10KWS
- 브리다 정수기
- 화분벌레
- VARIDESK
- 고체 향수
- weka
- 카카오 에드
- Pixel Pals
- 솔리드 쿨론
- 코라나 19
- node.js
- 유가바이트디비
- 톡토기
- 남설 팔찌
- 배당급
- 매직 트랙패드2
- 루미큐브 종류
- 별이 빚나는 밤
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |