Skip to content
forms-raw_singleitemedit-icon
navigation
modification_btn
docs
messages
flatprojectmap.handlebars
Database System
modificationbutton
docs_htmltables.handlebars

Database System

docs_html.handlebars
documentation.handlebars
Mongodb

To prevent model name collisions across multiple plugins or modules, all Mongoose models must include a unique namespace prefix in both the model name and the underlying collection name. This ensures that no two plugins accidentally register or reference the same model identifier, even if they define similar entities (e.g., Area, Project, Document).

Each plugin should define its models using a prefixed constant pattern:

                    const MODEL_NAME = 'pluginprefix_modelname';
                    const COLLECTION = 'pluginprefix_collectionname';
                    
                    module.exports =
                      mongoose.models[MODEL_NAME] ||
                      mongoose.model(MODEL_NAME, SchemaDefinition, COLLECTION);
                    

The same prefix should also be applied consistently in all references (e.g., ref: 'pluginprefix_modelname') to maintain relational integrity across collections. This convention guarantees isolated data schemas and eliminates naming conflicts between independently loaded plugins or modules.

modal1
modal2
modal3
docs_javascript
new_issue_button.handlebars
shortcut_edit