[英]Get all in MongoDB collection using SocialCMS with Breeze
I'm using SocialCMS Database middleware https://github.com/dai-shi/social-cms-backend with BreezeJS support. 我正在使用带有BreezeJS支持的SocialCMS数据库中间件https://github.com/dai-shi/social-cms-backend 。
I'm able to save changes to a MongoDB collection fine using manager.saveChanges()
and manager.acceptChanges()
and retrieve records in local cache using getEntities()
我可以使用manager.saveChanges()
和manager.acceptChanges()
将更改保存到MongoDB集合中,并使用getEntities()
检索本地缓存中的记录
Using this middleware 使用这个中间件
With BreezeJS support: 在BreezeJS支持下:
var SCB_options = {
mongodb_url: 'mongodb://localhost:27017/socialcmsdb',
breeze_mongo: true,
routes: [{
object_type: 'user',
object_prefix: '/breeze-service/users'
}, {
object_type: 'post',
object_prefix: '/breeze-service/posts'
}, {
object_prefix: '/breeze-service/SaveChanges'
}]
};
How do I retrieve all remote records belonging to a particular route? 如何检索属于特定路由的所有远程记录? For example, I want to retrieve all total posts remotely not in the users cache. 例如,我要远程检索不在用户缓存中的所有帖子。
Do I modify app.js, my Angular apps datacontext, both or neither? 我是否同时修改app.js和Angular应用程序的数据上下文?
I solved this problem. 我解决了这个问题。 It's a bit hard to discern from the Social CMS docs that the routes are local first. 从Social CMS文档中很难看出路由是本地优先的。 Which is great if you want to route without internet access! 如果您想在没有互联网的情况下进行路由,那是很棒的选择! But I needed to create new routes outside of the SCB_options
in order to request mongoDB directly. 但是我需要在SCB_options
之外创建新路由,以便直接请求mongoDB。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.