@chevre/domain
Version:
Chevre Domain Library for Node.js
33 lines (25 loc) • 887 B
text/typescript
// tslint:disable:no-console
// import * as moment from 'moment';
import * as mongoose from 'mongoose';
import { chevre } from '../../../lib/index';
// const excludedProject = { id: String(process.env.EXCLUDED_PROJECT_ID) };
async function main() {
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
const aggregateOfferRepo = await chevre.repository.AggregateOffer.createInstance(mongoose.connection);
let updateResult: any;
updateResult = await aggregateOfferRepo.unsetUnnecessaryFields({
filter: {
'offers.includedInDataCatalog.id': { $exists: true }
// _id: { $eq: 'blj55y1mo' }
},
$unset: {
'offers.0.includedInDataCatalog': 1
}
});
console.log(updateResult);
}
main()
.then(() => {
console.log('success!');
})
.catch(console.error);