Tag: meteor collection2

处理meteor客户端的错误

我目前正在使用meteor-collection2而且我的validation系统出现错误。 在“lib”文件夹中,我定义了我的集合,并为其添加了一个SimpleSchema 。 然后,我定义了一个Meteor.method : # define methods Meteor.methods # create RecipeCommentCreate: (options) -> # find recipe recipe = Recipes.findOne(options.recipeId) if !recipe throw new (Meteor.Error)(404, 'Recipe not found') # init comment comment = message: options.message recipe: _id: recipe._id # insert comment RecipeComments.insert(comment) 所以,这个代码在client-side和server-side ,使用延迟补偿(这是完美的,因为collection2可以在双方工作)。 但是,在调用这个方法时(感谢客户端的事件): # call method Meteor.call 'RecipeCommentCreate', options, (error, result) -> if […]

SimpleSchema或collection2中的ObjectId

我只是玩meteor,开始使用简单模式和collection2。 我从mongoose和节点搬来,所以我的问题可能会有点小白,所以请忍受我。 在mongoose中,我可以添加一个名为schema.ObjectId的types,在某些字段中模拟引用,但是在collection2中我没有看到任何这样的含义。 有没有快速的解决scheme? 正在使用type:String这个场景的一个好主意? 提前致谢