我想在我的MEANJS应用程序中使用$和。我在我的服务中使用$ resource来获取所有查询参数,并且想要执行AND操作。我的服务是这样的:
//Words service used to communicate Words REST endpoints
(function() {
'use strict';
angular
.module('words')
.factory('querywordsService', querywordsService);
querywordsService.$inject = ['$resource'];
function querywordsService($resource) {
var wordsData = $resource('/api/words/?syllableCount=:count&syllableStructur=:struct&frequency=:freq&emphasis=:emph',
{ count: '@count', struct: '@struct', freq: '@freq', emph: '@emph' },
{
update: {
method: 'PUT'
}
});
return {
wordsData: wordsData
};
}
})();
在我的Ctrl键我使用的功能设置@count和其他参数来构建查询我所需要的。我想要完成的是为@count和其他人提供多个值。我可能在前端,或者我需要在后端执行它(如果是这样,你能指出我在哪里开始的正确方向?)
要澄清更多,我需要在我的控制器中做这样的事情,有没有办法去做到这一点? 'db.words.find({$ and:[{$ or:[{syllableCount:1},{syllableCount:2}]},{$或:[{syllableStructur:“einfach”},{syllableStructur:“komplex” }]}]})' – d8ta