3.0.17 • Published 5 years ago

@knetik/micro-mongoose v3.0.17

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

Knetik Micro Mongoose

This package add the mongoose mongodb client to any micro-core application as a multi tenant adaptor

When a customer connects to a micro-core application, the required app_id is passed into the mongoose initializer and used as the database name. Then creating a connection and loading any mongoose models defined in the models directory.

In app/models/example.mongoose.js

const mongoose = require('mongoose');

const ExampleSchema = new mongoose.Schema({
    'prop': { 'type': Number, 'required': true },
}, { 'strict': true });

module.exports = mongoose.model('Example', ExampleSchema);

In micro-console

App.connect(app_id, access_token)
.then(App => App.Mongoose.get('Exmaple'))
.then(Example => Example.create({ prop: 42 }))
.then(res => console.log(res))
.catch(err => console.log(err))

In a micro-core module

module.exports (App) => {
  cosnt Example = App.Mongoose.get('Exmaple')
  Example.create({ prop: 42 })
}
3.0.17

5 years ago

3.0.16

5 years ago

3.0.15

5 years ago

3.0.14

5 years ago

3.0.13

5 years ago

3.0.12

5 years ago

3.0.11

5 years ago

3.0.10

5 years ago

3.0.9

5 years ago

3.0.7

5 years ago

3.0.6

5 years ago

3.0.5

5 years ago

3.0.4

5 years ago

3.0.3

5 years ago

3.0.2

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.0.24

5 years ago

2.0.23

5 years ago

2.0.22

5 years ago

2.0.21

5 years ago

2.0.20

5 years ago

2.0.19

5 years ago

2.0.18

5 years ago

2.0.17

5 years ago

2.0.16

5 years ago

2.0.15

5 years ago

2.0.14

5 years ago

2.0.13

5 years ago

2.0.12

6 years ago

2.0.11

6 years ago

2.0.10

6 years ago

2.0.9

6 years ago

2.0.8

6 years ago

2.0.7

6 years ago

2.0.6

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago