Update mongoose method usage o drop deprecated use
parent
5b3ac4496c
commit
d66fabe387
|
@ -7,8 +7,9 @@ module.exports = {
|
|||
db: 'cc',
|
||||
mongooseConfig: {
|
||||
useNewUrlParser: true,
|
||||
useCreateIndex: true
|
||||
}
|
||||
useCreateIndex: true,
|
||||
useFindAndModify: false,
|
||||
},
|
||||
},
|
||||
|
||||
prod: {
|
||||
|
|
|
@ -104,16 +104,16 @@ campaigns.route('/:id')
|
|||
WarModel.find({campaign: req.params.id}, (err, wars) => {
|
||||
wars.forEach((item) => {
|
||||
// delete linked appearances
|
||||
PlayerModel.find({warId: item._id}).remove().exec();
|
||||
LogKillModel.find({war: item._id}).remove().exec();
|
||||
LogVehicleKillModel.find({war: item._id}).remove().exec();
|
||||
LogRespawnModel.find({war: item._id}).remove().exec();
|
||||
LogReviveModel.find({war: item._id}).remove().exec();
|
||||
LogFlagModel.find({war: item._id}).remove().exec();
|
||||
LogBudgetModel.find({war: item._id}).remove().exec();
|
||||
LogTransportModel.find({war: item._id}).remove().exec();
|
||||
LogPointsModel.find({war: item._id}).remove().exec();
|
||||
LogPlayerCountModel.find({war: item._id}).remove().exec();
|
||||
PlayerModel.find({warId: item._id}).deleteMany();
|
||||
LogKillModel.find({war: item._id}).deleteMany();
|
||||
LogVehicleKillModel.find({war: item._id}).deleteMany();
|
||||
LogRespawnModel.find({war: item._id}).deleteMany();
|
||||
LogReviveModel.find({war: item._id}).deleteMany();
|
||||
LogFlagModel.find({war: item._id}).deleteMany();
|
||||
LogBudgetModel.find({war: item._id}).deleteMany();
|
||||
LogTransportModel.find({war: item._id}).deleteMany();
|
||||
LogPointsModel.find({war: item._id}).deleteMany();
|
||||
LogPlayerCountModel.find({war: item._id}).deleteMany();
|
||||
|
||||
// check if logfiles exist and delete from fs
|
||||
const warDir = resourceLocation + item.id;
|
||||
|
|
|
@ -170,7 +170,7 @@ decorationRouter.route('/:id')
|
|||
}
|
||||
|
||||
// deleted all awardings linked to this decoration
|
||||
AwardingsModel.find({decorationId: id}).remove().exec();
|
||||
AwardingsModel.find({decorationId: id}).deleteMany();
|
||||
|
||||
// delete graphic
|
||||
fs.unlink(resourceLocation.concat(id).concat('.png'),
|
||||
|
|
|
@ -191,7 +191,7 @@ users.route('/:id')
|
|||
}
|
||||
|
||||
// deleted all awardings linked to this user
|
||||
AwardingModel.find({userId: req.params.id}).remove().exec();
|
||||
AwardingModel.find({userId: req.params.id}).deleteOne();
|
||||
|
||||
// check if signature exists and delete compressed and uncompressed file
|
||||
const fileMinified = resourceLocation + req.params.id + '.png';
|
||||
|
|
|
@ -15,7 +15,7 @@ chai.use(chaiHttp);
|
|||
// Our parent block
|
||||
describe('Awardings', () => {
|
||||
beforeEach((done) => { // Before each test we empty the database
|
||||
AwardingModel.remove({}, (err) => {
|
||||
AwardingModel.deleteMany({}, (err) => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@ chai.use(chaiHttp);
|
|||
// Our parent block
|
||||
describe('Command', () => {
|
||||
beforeEach((done) => { // Before each test we empty the database
|
||||
AwardingModel.remove({}, (err) => {
|
||||
AwardingModel.deleteMany({}, (err) => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@ chai.use(chaiHttp);
|
|||
// Our parent block
|
||||
describe('Decorations', () => {
|
||||
beforeEach((done) => { // Before each test we empty the database
|
||||
DecorationModel.remove({}, (err) => {
|
||||
DecorationModel.deleteMany({}, (err) => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@ chai.use(chaiHttp);
|
|||
// Our parent block
|
||||
describe('Ranks', () => {
|
||||
beforeEach((done) => { // Before each test we empty the database
|
||||
RankModel.remove({}, (err) => {
|
||||
RankModel.deleteMany({}, (err) => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@ chai.use(chaiHttp);
|
|||
// Our parent block
|
||||
describe('Squads', () => {
|
||||
beforeEach((done) => { // Before each test we empty the database
|
||||
SquadModel.remove({}, (err) => {
|
||||
SquadModel.deleteMany({}, (err) => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@ -24,7 +24,7 @@ describe('Squads', () => {
|
|||
*/
|
||||
describe('/GET squads', () => {
|
||||
it('it should GET all the squads', (done) => {
|
||||
chai.request(server)
|
||||
chai.deleteMany(server)
|
||||
.get(urls.squads)
|
||||
.end((err, res) => {
|
||||
res.should.have.status(codes.success);
|
||||
|
|
|
@ -15,7 +15,7 @@ chai.use(chaiHttp);
|
|||
// Our parent block
|
||||
describe('Users', () => {
|
||||
beforeEach((done) => { // Before each test we empty the database
|
||||
UserModel.remove({}, (err) => {
|
||||
UserModel.deleteMany({}, (err) => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue