@chevre/domain
Version:
Chevre Domain Library for Node.js
28 lines (21 loc) • 716 B
text/typescript
// tslint:disable:no-implicit-dependencies no-console
import { chevre } from '../../../lib/index';
import * as moment from 'moment';
import * as mongoose from 'mongoose';
// const project = { id: String(process.env.PROJECT_ID) };
async function main() {
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
const taskRepo = await chevre.repository.Task.createInstance(mongoose.connection);
const expiresLt = moment()
.add(-1, 'hour')
.toDate();
const result = await taskRepo.makeExpiredMany({
expiresLt
});
console.log('result:', result);
}
main()
.then(() => {
console.log('success!');
})
.catch(console.error);