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