使用Meteor Ground DB软件包在Ionic2 Project中使用Meteor Ground DB软件包的错



我正在使用我的ionic2/angular2应用程序使用流星/mongo。在我的应用程序中,我需要客户数据才能脱机。我遇到了Meteor Package地面db https://atmospherejs.com/ground/db,以持续使用,但在客户端创建地面收藏时遇到了错误。

i将客户端和服务器共有的collections.ts收集。我的代码是

export const Messages = new MongoObservable.Collection("messages");
if(Meteor.isClient){
    Ground.Collection(Messages);
    Ground.Collection(Meteor.users);
}

在客户端中,我正在获取错误

"First argument to new Mongo.Collection must be a string or null
    at v (polyfills.js:3)
    at new Mongo.Collection (meteor-client.js:32177)
    at Object.groundCollection [as Collection]"

我的地面:DB版本为0.3.15,流星版本为1.4.4.1。我将感谢有关此问题的任何帮助。

您可能只需要将"原始" Meteor Mongo Collection喂入Ground.Collection,而不是包裹一个Angular2-Meteor:

const Messages = new MongoObservable.Collection("messages");
Ground.Collection(Messages.collection);
  • Messages是带有RXJS可观察物包装器的Angular2-Meteor系列。

  • Messages.collection是基础流星Mongo Collection(即,如果直接执行new Mongo.Collection("messages"),您将获得什么(

相关内容

最新更新