db - fix deprecation warnings and index timestamps
This commit is contained in:
parent
b7a7b95972
commit
6feab9ef68
@ -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) => {
|
||||
|
@ -33,7 +33,8 @@ methods.connect = async () => {
|
||||
mongoose.connect(cfg.mongoose.uri, {
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true,
|
||||
useFindAndModify: false
|
||||
useFindAndModify: false,
|
||||
useCreateIndex: true
|
||||
});
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user