0.2.4 • Published 5 years ago

hapi-mongooses v0.2.4

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

hapi-mongooses

一款用于hapi中多mongoose连接的hapi插件

参数配置

server.register(
  require('hapi-mongooses'),
  {
    default: `mongodb://username:${encodeURIComponent('password')}@hostname:port/defaultDb`,
    other: `mongodb://username:${encodeURIComponent('password')}@hostname:port/otherDb`,
  }
)

依赖使用

server.dependency('hapi-mongooses', () => {
  const { mongoose, connections, ObjectId, connection, Schema } = server.plugins['hapi-mongooses']
  // const defaultConnection = connections['default']
  const defaultConnection = connection
  const otherConnection = connections['other']
})

其他说明

  • ObjectId === mongoose.Types.ObjectId
0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago