简体   繁体   English

Keystone:将mongoose连接传递给Keystone选项

[英]Keystone: Pass mongoose connection into Keystone options

Looking at the documentation, it is possible to pass an instance of Mongoose into the Keystone options: 查看文档,可以将一个Mongoose实例传递给Keystone选项:

http://keystonejs.com/docs/configuration/

"mongoose Object: Instance of Mongoose to be used instead of the default instance." “mongoose对象:使用Mongoose的实例而不是默认实例。”

But how...? 但是......怎么样? How do I get the instance from Mongoose? 我如何从Mongoose获取实例?

You need to require mongoose yourself, configure it, and then pass it to keystone under the mongoose key 你需要自己要求mongoose ,配置它,然后在mongoose键下传递给keystone

var yourMongoose = require('mongoose')

// init mongoose

keystone.init({mongoose: yourMongoose})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM