Strongloop不能使用mongodb功能

时间:2023-01-14 22:56:43

I'm using AngularJS Sdk from Strongloop to develop the mobile application with ionicframework.

我正在使用Strongloop的AngularJS Sdk开发带有离子框架的移动应用程序。

In between the development progress, i failed to use the mongodb function from angular. I always get the unexpected result without any error message. Hope can get some help. Thanks.

在开发进度之间,我没有使用角度的mongodb函数。我总是得到意外的结果,没有任何错误信息。希望可以得到一些帮助。谢谢。

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

1 个解决方案

#1


1  

Loopback AngularJS SDK provides client-side representation of the models and remote methods in the LoopBack server application. What you actually use is not MongoDB query (at least not directly). You are calling angular service which is calling remote method from persisted model on server. Loopback then translates your request to query using database connector. In your case this is MongoDB connector.

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

That being said correct way to use find method in loopback angularjs sdk is:

这就是说在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
    });

#1


1  

Loopback AngularJS SDK provides client-side representation of the models and remote methods in the LoopBack server application. What you actually use is not MongoDB query (at least not directly). You are calling angular service which is calling remote method from persisted model on server. Loopback then translates your request to query using database connector. In your case this is MongoDB connector.

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

That being said correct way to use find method in loopback angularjs sdk is:

这就是说在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
    });