データの
Mongodb
のAggregation Pipeline
を
Google
検索のSQL
感覚で
思った
わかってしまえば、
対象レコード
以下のMongodb
のCollection
に
{ "_id" : ObjectId("578cfbe617470e0ee0e5d954"), "_target" : "ALL", "_classify" : "DMI_SCHEDULED_THREAD_POOL_EXECUTOR_WITH_ZERO_CORE_THREADS", "Bug" : { "@code" : "Dm" }, "_row_url" : "https://raw.githubusercontent.com/Alluxio/alluxio/31fccef69e8c1e680588bf19c27f08968a497319/build/findbugs/findbugs-exclude.xml", "_count" : 20 } { "_id" : ObjectId("578cfbe617470e0ee0e5d955"), "_target" : "ALL", "_classify" : "DMI_CONSTANT_DB_PASSWORD", "Bug" : { "@code" : "Dm" }, "_row_url" : "https://raw.githubusercontent.com/Alluxio/alluxio/31fccef69e8c1e680588bf19c27f08968a497319/build/findbugs/findbugs-exclude.xml", "_count" : 21 } { "_id" : ObjectId("578cfbe617470e0ee0e5d956"), "_target" : "ALL", "_classify" : "DMI_EMPTY_DB_PASSWORD", "Bug" : { "@code" : "Dm" }, "_row_url" : "https://raw.githubusercontent.com/Alluxio/alluxio/31fccef69e8c1e680588bf19c27f08968a497319/build/findbugs/findbugs-exclude.xml", "_count" : 22 } { "_id" : ObjectId("578cfbe617470e0ee0e5d957"), "_target" : "ALL", "_classify" : "DMI_UNSUPPORTED_METHOD", "Bug" : { "@code" : "Dm" }, "_row_url" : "https://raw.githubusercontent.com/Alluxio/alluxio/31fccef69e8c1e680588bf19c27f08968a497319/build/findbugs/findbugs-exclude.xml", "_count" : 23 }
Aggregation データが 取得できない クエリ
これで
db.findbugs_file_collect_result.aggregate([ { $group: { _id: "$_classify" , "count": { $sum: 1 } }}, { $match: { "_target" : "ALL" }}, ]);
aggregate
にjson
は、
Pipeline
と
{ $group: { _id: "$_classify" , "count": { $sum: 1 } }}
{ $match: { "_target" : "ALL" }}
に評価が
キー _target
を
Aggregation データが 取得できる クエリ
$match
と、$group
を
db.findbugs_file_collect_result.aggregate([ { $match: { "_target" : "ALL" }}, { $group: { _id: "$_classify" , "count": { $sum: 1 } }} ]);
はまりましたが、
以上です。
コメント