我正在测试meteor-persistent-minimongo2
以获取离线数据支持。虽然离线数据功能正常,但我在浏览器控制台上看到一些插入失败的错误:WriteError({"code":11000,"index":0,"errmsg":"E11000 duplicate key error
。这些错误是随机发生的,有时它会在一段时间内仅为一条记录提供三条记录等的错误,因为我不断刷新页面。服务器端没有错误,因此这与客户端& minimongo
。
我在mycollection.js
;
export const MyCollection = new Mongo.Collection('mycollection');
if (Meteor.isClient) {
console.log('Setting Mini Mongo Observer');
const persistentColl = new PersistentMinimongo2(MyCollection, 'testapp');
}
显然,meteor-persistent-minimongo2
会尝试将现有文档插入minimongo
。但insert
操作的source code似乎是正确的。我在这里想念什么?