UNPKG

mongosuper

Version:

mongosuper is a superset of mongoose. It is a wrapper around mongoose. It manage your mongoose connection and keep it alive always. It also provide you some extra features like CRUD operations, etc.

42 lines 2 kB
(function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { define(["require", "exports", "mongoose"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CreateModel = void 0; const mongoose_1 = require("mongoose"); // Import mongoose types /** * This is an asynchronous function that returns a model based on a given data schema and collection * name, or undefined if no collection name is provided. * @param {globe} DataSchema - The DataSchema parameter is a variable of type "globe", which is not a * standard data type in JavaScript. It is likely a custom data type defined elsewhere in the code. * Without more information, it is difficult to determine what this variable represents. * @param {str} [CollectionName] - CollectionName is an optional parameter of type string. It * represents the name of the collection in the database where the data will be stored. If it is not * provided, the function will return undefined. * @returns If `CollectionName` is `undefined`, then `undefined` is being returned. Otherwise, a model * is being returned based on the `DataSchema` and `CollectionName`. */ function CreateModel(DataSchema, CollectionName) { switch (CollectionName) { case undefined: return undefined; default: try { return (0, mongoose_1.model)(CollectionName, DataSchema); } catch (err) { console.log(err); return undefined; } } } // end of function exports.CreateModel = CreateModel; }); //# sourceMappingURL=CreateModel.js.map