ihub-framework-js
Version:
Legacy version of iHub Framework written in Javascript
37 lines (32 loc) • 708 B
JavaScript
const mongoose = require('mongoose');
const { Schema } = mongoose;
const schema = new Schema({
namespace: {
type: String,
required: true,
unique: true,
index: true,
},
name: {
type: String,
required: true,
},
options: {
type: Array,
},
value: {
type: 'Mixed',
require: true,
},
});
/* eslint-disable func-names */
schema.statics.staticFunctionExample = function () {
return new Promise((resolve, reject) => {
this.model('ExampleModel').find({}, (err, doc) => {
if (err) return reject(err);
if (!doc) return resolve(undefined);
return resolve(doc);
});
});
};
module.exports = mongoose.model('ExampleGlobalModel', schema);