Files
freeplanet_serverside/src/server/models/cfgserver.js
Surya Paolo 53a70a1c96 - Aggiornato node.js alla versione 22.18.1
- Aggiornato tutti i pacchetti del server all'ultima versione.
- passato mongoose da versione 5 a versione 6
2025-03-03 00:46:08 +01:00

53 lines
1.0 KiB
JavaScript
Executable File

const mongoose = require('mongoose').set('debug', false)
const Schema = mongoose.Schema;
mongoose.Promise = global.Promise;
mongoose.level = "F";
const tools = require('../tools/general');
const { ObjectId } = require('mongodb');
// Resolving error Unknown modifier: $pushAll
mongoose.plugin(schema => {
schema.options.usePushEach = true
});
const CfgServerSchema = new Schema({
chiave: {
type: String,
trim: true,
minlength: 1,
},
idapp: {
type: String,
},
userId: {
type: String,
},
valore: {
type: String,
},
});
CfgServerSchema.statics.DuplicateAllRecords = async function (idapporig, idappdest) {
return await tools.DuplicateAllRecords(this, idapporig, idappdest);
};
CfgServerSchema.statics.findAllIdApp = async function(idapp) {
const myfind = { idapp };
return await CfgServer.find(myfind).lean();
};
const CfgServer = mongoose.model('CfgServer', CfgServerSchema);
CfgServer.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = {CfgServer};