for (el of searchData) {
dataResultArray(await Data.findOne({ el: el }))
}
async function main() {
let Data = mongoose.model('data', DataSchema)
let searchData = [...]
for (el of searchData) {
dataResultArray(await Data.findOne({ el: el }))
}
}
main();
$arr1 = [
'04.02.2013-03.03.2013',
'04.03.2013-03.04.2013',
'04.12.2013-03.01.2014',
'04.01.2014-03.02.2014',
'04.12.2014-03.01.2015',
'04.01.2015-03.02.2015',
'04.02.2015-03.03.2015',
];
$result = [];
foreach ($arr as $r) {
$year = [];
if (preg_match('/.[0-9]{4}/', $r, $year)) {
$year = $year[0];
if (!isset($result[$year]) {
$result[$year] = [];
}
$result[$year][] = str_replace(".$year", '', $r);
}
}