- Aggiornato tutti i pacchetti del server all'ultima versione. - passato mongoose da versione 5 a versione 6
33 lines
680 B
JavaScript
Executable File
33 lines
680 B
JavaScript
Executable File
const mongoose = require('mongoose').set('debug', false)
|
|
const Schema = mongoose.Schema;
|
|
|
|
mongoose.Promise = global.Promise;
|
|
mongoose.level = "F";
|
|
|
|
const { ObjectId } = require('mongodb');
|
|
|
|
// Resolving error Unknown modifier: $pushAll
|
|
mongoose.plugin(schema => {
|
|
schema.options.usePushEach = true
|
|
});
|
|
|
|
|
|
const SubscriberSchema = new Schema({
|
|
endpoint: String,
|
|
keys: Schema.Types.Mixed,
|
|
userId: String,
|
|
access: String,
|
|
browser: String,
|
|
createDate: {
|
|
type: Date,
|
|
default: Date.now
|
|
}
|
|
});
|
|
|
|
var Subscription = module.exports = mongoose.model('subscribers', SubscriberSchema);
|
|
|
|
Subscription.createIndexes()
|
|
.then(() => { })
|
|
.catch((err) => { throw err; });
|
|
|