1
0
Fork 0

db - fix deprecation warnings and index timestamps

This commit is contained in:
Ruben Meyer 2020-10-30 23:19:48 +01:00
parent b7a7b95972
commit 6feab9ef68
Signed by: rxbn_
GPG Key ID: BE3BF898BE352FE2
2 changed files with 3 additions and 2 deletions

View File

@ -86,7 +86,7 @@ models.authCode = new Schema({
applicationId: Schema.Types.ObjectId, // reference to application applicationId: Schema.Types.ObjectId, // reference to application
userId: Schema.Types.ObjectId, // reference to user userId: Schema.Types.ObjectId, // reference to user
token: String, // generated token, only usable in combination with userId and applicationId token: String, // generated token, only usable in combination with userId and applicationId
timestamp: { type: Date, default: Date.now } timestamp: { type: Date, default: Date.now, index: {unique: true, expires: '5m'} }
}); });
module.exports = (con) => { module.exports = (con) => {

View File

@ -33,7 +33,8 @@ methods.connect = async () => {
mongoose.connect(cfg.mongoose.uri, { mongoose.connect(cfg.mongoose.uri, {
useNewUrlParser: true, useNewUrlParser: true,
useUnifiedTopology: true, useUnifiedTopology: true,
useFindAndModify: false useFindAndModify: false,
useCreateIndex: true
}); });