yapi icon indicating copy to clipboard operation
yapi copied to clipboard

添加接口,报 E11000 duplicate k index的错误

Open graceTesterZhang opened this issue 5 years ago • 7 comments

版本号

~ yapi:1.5.10 mongo: 3.2

什么问题

在yapi页面新增接口,点击提交,页面报“服务出错”,查看服务的log,报错信息为: [ error ] E11000 duplicate key error collection: yapi.interface index: id dup key: { : 1750 }

再次点击提交,可成功添加接口。 重启yapi服务后,就好了。

如何复现此问题

~ 添加接口

什么浏览器

~ chrome

什么系统(Linux, Windows, macOS)

centos

graceTesterZhang avatar May 10 '19 06:05 graceTesterZhang

你好,请问这个问题怎么解决的?

zhangdongjia avatar Sep 02 '19 05:09 zhangdongjia

同问

100001 avatar Jan 15 '20 11:01 100001

最新版本同样出现这个问题,请问是怎么解决的?

TheLittleBoy avatar Jul 22 '21 07:07 TheLittleBoy

同问我是 MongoError: E11000 duplicate key error collection: yapi.interface index: id dup key: { : 845 } at Function.create (/home/ubuntu/my-yapi/vendors/node_modules/mongoose/node_modules/mongodb/lib/core/error.js:44:12) at toError (/home/ubuntu/my-yapi/vendors/node_modules/mongoose/node_modules/mongodb/lib/utils.js:150:22) at coll.s.topology.insert (/home/ubuntu/my-yapi/vendors/node_modules/mongoose/node_modules/mongodb/lib/operations/common_functions.js:266:39) at handler (/home/ubuntu/my-yapi/vendors/node_modules/mongoose/node_modules/mongodb/lib/core/sdam/topology.js:973:24) at wireProtocol.(anonymous function) (/home/ubuntu/my-yapi/vendors/node_modules/mongoose/node_modules/mongodb/lib/core/sdam/server.js:437:5) at /home/ubuntu/my-yapi/vendors/node_modules/mongoose/node_modules/mongodb/lib/core/connection/pool.js:420:18 at process._tickCallback (internal/process/next_tick.js:61:11)

这样的报错,重启无效

lanteng008 avatar Jan 14 '22 09:01 lanteng008

重启也是无效,请问怎么解决?

yangxiuze avatar Aug 22 '22 09:08 yangxiuze

我也出现了这个问题

Nnaking avatar Aug 28 '22 02:08 Nnaking

应该是数据出了问题。如果备份了之前的数据,删掉yapi数据库,重新导入之前没有问题的备份数据就可以了。

Aubreyzhong avatar Jun 14 '23 03:06 Aubreyzhong