@chevre/domain
Version:
Chevre Domain Library for Node.js
37 lines (31 loc) • 967 B
text/typescript
// tslint:disable:no-console
import * as mongoose from 'mongoose';
import { chevre } from '../../../lib/index';
const project = { id: String(process.env.PROJECT_ID) };
async function main() {
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
const eventSeriesRepo = await chevre.repository.EventSeries.createInstance(mongoose.connection);
const result = await eventSeriesRepo.aggregateMaxVersion(
{
project: {
id: { $eq: project.id }
},
workPerformed: {
identifier: {
$eq: '00001'
}
},
location: {
branchCode: {
$in: ['118']
}
}
}
);
// tslint:disable-next-line:no-null-keyword
console.dir(result, { depth: null });
console.log(result);
}
main()
.then(console.log)
.catch(console.error);