Meteor.js and Mongoose Compatibility

走远了吗. 提交于 2020-01-13 20:46:09

问题


I want to use the Mongoose ORM with meteor mainly on the server side until meteor releases a schema approach.

Can i call Mongoose ORM operations within Meteor methods and publish using the Mongoose retrieving methods likefindById.

Are there any potential problems or meteor features that i would miss out on if i approached things this way?


回答1:


Unfortunately, there are problems. We've wanted to do the same thing, but (out of the box) the mongoose package doesn't use Meteor's DDP protocol, and won't trigger the reactivity when you do CRUD operations. There may be also issues with Fibers/etc, although we haven't pushed with Mongoose enough to find them.

The good news is that (server-side) Meteor watches the db for any changes, DDP-induced or not, and will pick them up in about 10-seconds or so. It will then publish them to the clients, which will pick them up in standard meteor format.

We've been looking for a mongoose-ddp-meteor package to solve this issue, and might have to end up building one ourselves.

EDIT: As of December 2013, Meteor's Mongo package listens to Mongo's oplog, and will reflect any changes done by external mongoose activity in real-time.



来源:https://stackoverflow.com/questions/15854804/meteor-js-and-mongoose-compatibility

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!