cursor = db.flow.aggregate([
    {
        $match : {
            timeFirst : { $gte : time_from },
            timeLast  : { $lte : time_to },
        }
    },
    {
        $group : {
            _id : null,
            timeFirst : { $min : "$timeFirst" },
            timeLast  : { $max : "$timeLast"  },
            pkts  : { $sum : "$numPktsSnt"  },
            bytes : { $sum : "$numBytesSnt" },
        }
    }
])

cursor.forEach(
    function(e) {
        print(
              e.timeFirst / 1000 + "\t"
            + e.timeLast  / 1000 + "\t"
            + e.pkts             + "\t"
            + e.bytes
        )
    }
)
