Files
freeplanet_serverside/src/models/cfgserver.js

53 lines
1.0 KiB
JavaScript
Raw Normal View History

2022-09-14 11:32:04 +02:00
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,
2020-04-24 10:29:25 +02:00
},
idapp: {
type: String,
},
2019-03-04 17:28:41 +01:00
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; });
2023-12-09 11:55:58 +01:00
module.exports = {CfgServer};