【问题标题】:Strongloop not able use mongodb functionStrongloop 无法使用 mongodb 函数
【发布时间】:2016-01-18 12:48:03
【问题描述】:

我正在使用 Strongloop 的 AngularJS Sdk 来开发具有 ionicframework 的移动应用程序。

在开发过程中,我没有使用 angular 的 mongodb 函数。我总是得到意想不到的结果,没有任何错误消息。希望能得到一些帮助。谢谢。

var feed$ = Feed.find({
            filter : {
                    $or : [{ accountId : "569a9fc898e6f58b0329eefc" }, { accountId : "569a9fa098e6f58b0329eefb" }]
            }
        });

【问题讨论】:

    标签: angularjs ionic-framework loopbackjs strongloop mobile-development


    【解决方案1】:

    Loopback AngularJS SDK 在 LoopBack 服务器应用程序中提供模型和远程方法的客户端表示。您实际使用的不是 MongoDB 查询(至少不是直接使用)。您正在调用从服务器上的持久模型调用远程方法的角度服务。 Loopback 然后使用database connector 将您的请求转换为查询。在您的情况下,这是 MongoDB 连接器。

    在loopback angularjs sdk中使用find方法的正确方法是:

      Feed.find({
          filter: {
            where: {
              or: [{accountId: "569a9fc898e6f58b0329eefc"}, {accountId: "569a9fa098e6f58b0329eefb"}]
            }
          }
        },
        function (feeds) {
            console.log(feeds); //query result is available in callback function
        });
    

    【讨论】:

    • 嗨,很抱歉回复晚了......我试过你的代码,它工作得很好......谢谢你的回复。
    猜你喜欢
    • 1970-01-01
    • 2017-06-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-03
    • 2016-06-13
    • 1970-01-01
    • 2014-12-25
    相关资源
    最近更新 更多