Browse Source

db - fix deprecation warnings and index timestamps

master
Ruben Meyer 1 year ago
parent
commit
6feab9ef68
Signed by: rxbn_ GPG Key ID: BE3BF898BE352FE2
  1. 2
      bin/database/models.js
  2. 3
      bin/database/module.js

2
bin/database/models.js

@ -86,7 +86,7 @@ models.authCode = new Schema({
applicationId: Schema.Types.ObjectId, // reference to application
userId: Schema.Types.ObjectId, // reference to user
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) => {

3
bin/database/module.js

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

Loading…
Cancel
Save