@chevre/domain
Version:
Chevre Domain Library for Node.js
28 lines (22 loc) • 726 B
text/typescript
// tslint:disable:no-console
import * as moment from 'moment';
import * as mongoose from 'mongoose';
import { chevre } from '../../../lib/index';
async function main() {
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
const lt: Date = moment()
// tslint:disable-next-line:no-magic-numbers
.add(-16, 'months')
.toDate();
let result: any;
result = await actionRepo.deleteStartDatePassedCertainPeriod({
$lt: lt
});
console.log('result:', result, lt);
}
main()
.then(() => {
console.log('success!');
})
.catch(console.error);