UNPKG

@chevre/domain

Version:

Chevre Domain Library for Node.js

31 lines (23 loc) 938 B
// tslint:disable:no-console import * as mongoose from 'mongoose'; import { chevre } from '../../../lib/index'; // const project = { id: String(process.env.PROJECT_ID) }; mongoose.Model.on('index', (...args) => { console.error('******** index event emitted. ********\n', args); }); async function main() { await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false }); const transactionRepo = await chevre.repository.Transaction.createInstance(mongoose.connection); const { count } = await transactionRepo.count<chevre.factory.transactionType.PlaceOrder>({ limit: 5000, // page: 1, // project: { id: { $eq: project.id } }, typeOf: chevre.factory.transactionType.PlaceOrder, statuses: [chevre.factory.transactionStatusType.InProgress], startThrough: new Date() }); console.log('count:', count); } main() .then() .catch(console.error);