私は幼い頃から MySQL を使用していましたが、現在はさまざまな理由で MongoDB に切り替える必要があります。
すべての PHP エラーを MongoDB コレクションに保存するログを作成します。エラーを読み取ることは問題ではありません。単純な find() を使用するのは非常に簡単で、php 配列を使用してデータを取得できるのは素晴らしいことです。
ここで、エラーに関する統計を取得したいと考えています。私のコレクションは次のようになります。
{
"_id": ObjectId("51af10ca0e5e723c0a000000"),
"Errors": {
"2048": {
"0": {
"Message": "Declaration of ADODB_mysqli::MetaIndexes() should be compatible with ADOConnection::MetaIndexes($table, $primary = false, $owner = false)",
"File": "File.php",
"Line": NumberInt(29),
"Time": NumberInt(1370427591)
}
},
"2": {
"0": {
"Message": "Error",
"File": "File.php",
"Line": NumberInt(29),
"Time": NumberInt(1370427591)
},
"1": {
"Message": "Error",
"File": "File.php",
"Line": NumberInt(29),
"Time": NumberInt(1370427591)
}
},
"8": {
"0": {
"Message": "Undefined index: PluginLastAdded",
"File": "File.php",
"Line": NumberInt(36),
"Time": NumberInt(1370427594)
},
"1": {
"Message": "Undefined index: PluginLastAdded",
"File": "File.php",
"Line": NumberInt(36),
"Time": NumberInt(1370427594)
}
}
}
}
ここで、このエントリの各エラーが発生する頻度を知りたいと思います。2048、2、8、および各エラーの数に分かれたリストがあると便利です。
PHPコードをあまり使わずに、MongoDBの集計を使用することは可能ですか?
私の意見では、MongoDB は MySQL とは 180 度異なり、切り替えは非常に困難です。