koishijs / koishi

Cross-platform chatbot framework made with love
https://koishi.chat
MIT License
4.5k stars 247 forks source link

koishi-plugin-mongo 直接使用 connection string #118

Closed arily closed 4 years ago

arily commented 4 years ago

Is your feature request related to a problem? Please describe.

比起分别输入host user pass和database 直接给connection string更快 (而且现行版本如果用mongodb+srv protocol 还会报错 Ports not accepted with 'mongodb+srv' URIs) Describe the solution you'd like

config中提供connection string

{
  uri: 'mongodb+srv://<user>:<password>@<host>/<database>?retryWrites=true&w=majority'
}

Describe alternatives you've considered

没想出来。 Additional context

shigma commented 4 years ago

@undefined-moe 你看着办(

undefined-moe commented 4 years ago
  1. config支持使用protocol项。
  2. connection string计划支持。
arily commented 4 years ago

https://github.com/koishijs/koishi/pull/119 👀

arily commented 4 years ago
  • config支持使用protocol项。
  • connection string计划支持。

是这样 如果用'mongodb+srv' 的话 connection string是不能有 port的 但是在index.js里port被赋予默认值,而且拼接connection string的时候会无论如何带上冒号。 需要config.port = undefined