1.3.1 • Published 2 years ago

openapi-nodegen-mongoose-loader v1.3.1

Weekly downloads
5
License
MIT
Repository
github
Last release
2 years ago

openapi-nodegen-mongoose-loader

The established connection will use the default options, these can be overridden with mongoOpts:

useCreateIndex: true,
useFindAndModify: false,
useNewUrlParser: true,
useUnifiedTopology: true

Loading with independent params:

import mongoLoader from 'openapi-nodegen-mongoose-loader';

mongoLoader({
  mongoAdditionalParams: 'authSource=admin',
  mongoDatabase: 'myapp',
  mongoHost: 'localhost',
  mongoOpts: {
    useCreateIndex: false
  },
  mongoPassword: 'password',
  mongoPort: 27017,
  mongoUser: 'username',
})
.then(() =>{
  // do something safe in the knowledge there is a connection to the db
})
.catch((e: any) => {
  // Do something with the error
});

Loading with full connection uri:

import mongoLoader from 'openapi-nodegen-mongoose-loader';

mongoLoader({
  mongoOpts: {
    useCreateIndex: false
  },
  mongoUri: 'someurlstring',
})
.then(() =>{
  // do something safe in the knowledge there is a connection to the db
})
.catch((e: any) => {
  // Do something with the error
});

See the index.d.ts file for type definition mongoLoader 1st argument.

1.3.1

2 years ago

1.3.0

2 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago