정보정리

MongoDB aggregate 기본 사용법

서창호 2020. 1. 3. 15:02
db.table.aggregate([{
	'$group': {'_id': {thread_id: '$thread_id', proc_name: '$proc_name'}, count:{$sum:1}}
    }]);



db.table.aggregate([{
	'$group': {'_id': {thread_id: '$thread_id', proc_name: '$proc_name'},
    	first: {$min: '$start_time'}, last: {$max: '$start_time'}, count:{$sum:1}}
    }]);

해당 조건으로 group.

match 등으로 필터링 또한 가능하다.