Json Restanglar-自定义搜索-在数组中搜索

Json Restanglar-自定义搜索-在数组中搜索,json,angularjs,mongodb,restangular,mlab,Json,Angularjs,Mongodb,Restangular,Mlab,假设我有一个mongodbitems集合,看起来像这样(MongoLab): 我想获取节点位于标记数组中的所有项目。 我尝试了以下操作,但没有成功-它将返回所有项目-是否未执行搜索 Plunker演示: 完整示例,返回两种情况下的相同记录: var all = db.all('items'); // GET ALL all.getList().then(function(data) { $scope.all = data; console

假设我有一个mongodb
items
集合,看起来像这样(MongoLab):

我想获取
节点
位于
标记
数组中的所有项目。 我尝试了以下操作,但没有成功-它将返回所有项目-是否未执行搜索

Plunker演示:

完整示例,返回两种情况下的相同记录:

    var all = db.all('items');

    // GET ALL
    all.getList().then(function(data) {
        $scope.all = data;
        console.log(data);
    });

    // SEARCH for record where "tags" has got "node"
    all.customGET('', { "tags": "node"}).then(function(data) {
        $scope.search = data;
        console.log(data);
    });
任何建议都将不胜感激。

根据,您必须使用
q
参数传递查询对象。在您的例子中,它是
q={“tags”:“node”}

使用Restangular将如下所示:

restanglar.all(“items”).customGET(“”,{q:{“tags”:“node”}})

根据需要,必须使用
q
参数传递查询对象。在您的例子中,它是
q={“tags”:“node”}

使用Restangular将如下所示:


restanglar.all(“items”).customGET(“”,{q:{“tags”:“node”}})

您提供的代码与您的问题无关。。。这似乎是一个很好的餐厅用语。。。它应该与您的服务器端相关。。。你能提供你的后端代码吗?@wickY26-我正在使用MongoLab作为后端。因此,问题一定出在我的
重新启动的搜索查询中。
。您提供的代码与您的问题无关。。。这似乎是一个很好的餐厅用语。。。它应该与您的服务器端相关。。。你能提供你的后端代码吗?@wickY26-我正在使用MongoLab作为后端。所以问题一定出在我的
重新启动的搜索查询上。。。这是正在工作的plunker。。。plunkr链接做得非常好。。。这是正在工作的plunker。。。plunkr链接已断开
// $route.current.params.id = "node" - should give me only 1 record with this tag
Restangular.all("items").customGET("", { "tags": $route.current.params.id });
    var all = db.all('items');

    // GET ALL
    all.getList().then(function(data) {
        $scope.all = data;
        console.log(data);
    });

    // SEARCH for record where "tags" has got "node"
    all.customGET('', { "tags": "node"}).then(function(data) {
        $scope.search = data;
        console.log(data);
    });