Browse Source

feat: Set mongoose global configuration values

Owen Diffey 11 months ago
parent
commit
c088c1a358
1 changed files with 9 additions and 0 deletions
  1. 9 0
      backend/src/modules/DataModule.ts

+ 9 - 0
backend/src/modules/DataModule.ts

@@ -39,6 +39,15 @@ export default class DataModule extends BaseModule {
 
 		await mongoose.connect(mongoUrl);
 
+		mongoose.set({
+			runValidators: true,
+			sanitizeFilter: true,
+			strict: "throw",
+			strictQuery: "throw"
+		});
+
+		mongoose.SchemaTypes.String.set("trim", true);
+
 		await this.loadModels();
 
 		// @ts-ignore