我在 Postman “UnknownReplWriteConcern”中得到此错误,

z3yyvxxp  于 2023-04-06  发布在  Postman
关注(0)|答案(7)|浏览(122)
{
    "code": 79,
    "codeName": "UnknownReplWriteConcern",
    "errInfo": {
        "writeConcern": {
            "w": "majority;",
            "wtimeout": 0,
            "provenance": "clientSupplied"
        }
    },
    "result": {
        "n": 1,
        "opTime": {
            "ts": {
                "$timestamp": "7022355027419201549"
            },
            "t": 99
        },
        "electionId": "7fffffff0000000000000063",
        "ok": 1,
        "writeConcernError": {
            "code": 79,
            "codeName": "UnknownReplWriteConcern",
            "errmsg": "No write concern mode named 'majority;' found in replica set configuration",
            "errInfo": {
                "writeConcern": {
                    "w": "majority;",
                    "wtimeout": 0,
                    "provenance": "clientSupplied"
                }
            }
        },
        "$clusterTime": {
            "clusterTime": {
                "$timestamp": "7022355027419201549"
            },
            "signature": {
                "hash": "r4QJwdZlD6X28hYUeg3kkVrI7uw=",
                "keyId": {
                    "low": 1,
                    "high": 1620408145,
                    "unsigned": false
                }
            }
        },
        "operationTime": {
            "$timestamp": "7022355027419201549"
        }
    }
}
clj7thdc

clj7thdc1#

我在Mongo URL的末尾添加了这个,它工作了-〉〉〉〉“&wtimeoutMS=5000”;

mctunoxg

mctunoxg2#

有一个类似的问题。发现我有一个额外的一套单引号周围我的数据库网址

ni65a41a

ni65a41a3#

我也遇到过同样的问题,把包含(writeConcern)的代码放在我的模式中,它就能工作了

const schema = new Schema({
   name: String
}, {
   writeConcern: {
      w: 'majority',
      j: true,
      wtimeout: 1000
   }
});

我做的另一件事是删除了数据库URL周围的一个引用:
查看此链接:https://pretagteam.com/question/mongowriteconcernerror-no-write-concern-mode-named-majority-found-in-replica-set-configuration

bttbmeg0

bttbmeg04#

mongodb+srv://admin:<password>@<yourClouster>/myFirstDatabase?retryWrites=true&w=majority

回顾你的联想没有“或”或;在决赛中

5hcedyr0

5hcedyr05#

检查你的mongo数据库网址...错误地我把一个'/'在最后

holgip5t

holgip5t6#

//在连接mongoose的地方使用这段代码。这段代码肯定会起作用。mongoose.connect(DB,{ useNewUrlParser:true,使用统一拓扑:true,writeConcern:{ w:'多数',j:true,wtimeout:1000 } })
//更多查询请访问alizahid069@gmail.com谢谢:)

balp4ylt

balp4ylt7#

在你的连接中使用这个.......它对我很有效mongoose.connect(DB,{ useNewUrlParser:true,使用统一拓扑:true,writeConcern:{ w:'多数',j:true,wtimeout:1000 } })

相关问题