import notifications from 'notifications';
import moment from 'moment';
const adminIds = org.objects.accounts
.find({roles: '000000000000000000000004'})
// set desired time periods.
const startDate = moment(new Date()).utc().subtract(1,'day').startOf('day').toDate(),
endDate = moment(new Date()).utc().subtract(1,'day').endOf('day').toDate();
const cursor = org.objects.c_widgets.aggregate()
.match({created: {$gte: startDate, $lte: endDate}})
.group({_id: null, count: {$count: '_id'}});
const count = cursor.hasNext() ? cursor.next().count : 0;
// send notification to admins.
notifications.send('c_daily_report', report, {recipient: _id})