将选项{useNewUrlParser:true}传递给MongoClient.connect

时间:2019-01-25 14:15:03

标签: mongodb docker-compose hyperledger-composer loopback

我想为composer-rest-server实施护照本地化策略

COMPOSER_CARD=admin@stschain
COMPOSER_NAMESPACES=never
COMPOSER_AUTHENTICATION=true
COMPOSER_MULTIUSER=true
COMPOSER_PROVIDERS='{
    "local": {
        "provider": "local", 
        "module": "passport-local", 
        "usernameField": "username", 
        "passwordField": "password", 
        "authPath": "/auth/local", 
        "callbackURL":"/auth/local/callback",
        "successRedirect": "/", 
        "failureRedirect": "/", 
        "setAccessToken": true, 
        "callbackHTTPMethod": "post" 
   },
}'
COMPOSER_DATASOURCES='{
    "db": {
        "name": "db",
        "connector": "mongodb",
        "host": "mongo"
    }
}'

我为启动的MongoDB docker容器运行了CMD:docker run -d --name mongo --network composer_default -p 27017:27017 mongo,并执行了实现此策略所需的所有操作,但是当我运行此cmd docker logs rest时,它显示了DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.

如何添加此选项useNewUrlParser,因为我在docker容器中运行mongodb

1 个答案:

答案 0 :(得分:0)

简单

COMPOSER_DATASOURCES='{
    "db": {
        "useNewUrlParser": true
        "name": "db",
        "connector": "mongodb",
        "host": "mongo"
    }
}'