将angular2与meteor一起使用,并提供以下数据:
#include <stdio.h>
#include <stdlib.h>
int main(void) {
FILE *fin;
FILE *fout;
int i,j;
int linecount = 0;
int alphabetCount[26];
if ((fin = fopen("blocks.in", "r")) == NULL) {
fprintf(stderr, "Unable to open input file\n");
exit(EXIT_FAILURE);
}
if ((fout = fopen("blocks.out", "w")) == NULL) {
fprintf(stderr, "Unable to open output file\n");
exit(EXIT_FAILURE);
}
fscanf(fin," %d",&linecount);
return 0;
}
我如何找到具有容量的工人 - available_capacity&gt; 10
如何找到具有available_capacity&gt; =容量的工人?
答案 0 :(得分:2)
我如何找到具有容量的工人 - available_capacity&gt; 10?
db.collection('workers').find({"capacity": {$gt: 10}}).toArray(function (err, res)
{
if (err) throw err;
console.log(res);
});
如何找到具有available_capacity&gt; = capacity?
的工作人员db.collection('workers').aggregate(
[
{
$project:
{
_id: 1,
name: 1,
capacity:1,
capacity_available: { $gte: $capacity},
location: 1
}
}
]
);
<强>更新强>
我刚用完了其他教程。我认为概念将是相同的
<强> Q1 强>
Workers = new Mongo.Collection('workers');
if (Meteor.isClient) {
// This code only runs on the client
angular.module('simple-todos',['angular-meteor']);
angular.module('simple-todos').controller('TodosListCtrl', ['$scope', '$meteor',
function ($scope, $meteor) {
$scope.findWorkers = $meteor.collection( function() {
return Workers.find({"capacity": {$gt: 10}});
});
}]);
}
<强> Q2 强>
我不知道总会在这里工作。猜猜
Workers = new Mongo.Collection('workers');
if (Meteor.isClient) {
// This code only runs on the client
angular.module('simple-todos',['angular-meteor']);
angular.module('simple-todos').controller('TodosListCtrl', ['$scope', '$meteor',
function ($scope, $meteor) {
$scope.findWorkers = $meteor.collection( function() {
return Workers.aggregate(
[
{
$project:
{
_id: 1,
name: 1,
capacity:1,
capacity_available: { $gte: $capacity},
location: 1
}
}
]
);
});
}]);
}