@nestjs/mongoose#MongooseModuleOptions TypeScript Examples
The following examples show how to use
@nestjs/mongoose#MongooseModuleOptions.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: config.service.ts From whispr with MIT License | 6 votes |
getMongooseOptions(): MongooseModuleOptions {
const options: MongooseModuleOptions = {
uri: this.getMongooseURI(),
dbName: 'whisps',
readPreference: this.get('REPLICASET') !== undefined ? 'primary' : null,
user: this.get('MONGOOSE_USERNAME'),
pass: this.get('MONGOOSE_PASSWORD'),
replicaSet: this.get('REPLICASET'),
useNewUrlParser: true,
useUnifiedTopology: true,
};
if (this.get('SSL_VALIDATE') === true) {
const ca = fs.readFileSync(this.get('PATH_TO_SSL_CERTIFICATE'));
options.server = {
ssl: true,
sslValidate: true,
sslCA: ca,
};
}
return options;
}
Example #2
Source File: MongooseTestModule.ts From whispr with MIT License | 6 votes |
rootMongooseTestModule = (options: MongooseModuleOptions = {}) => MongooseModule.forRootAsync({
useFactory: async () => {
mongod = await MongoMemoryServer.create();
const mongoUri = mongod.getUri();
return {
uri: mongoUri,
...options,
};
},
})
Example #3
Source File: MongooseTestModule.ts From uniauth-backend with MIT License | 6 votes |
rootMongooseTestModule = (options: MongooseModuleOptions = {}) =>
MongooseModule.forRootAsync({
useFactory: async () => {
mongod = new MongoMemoryServer();
const mongoUri = await mongod.getUri();
return {
uri: mongoUri,
...options,
};
},
})