correct typo, remove 'whatTable'

This commit is contained in:
rxf
2023-06-28 11:27:14 +02:00
parent 6857d75e9d
commit 6485ef63f6
3 changed files with 16 additions and 17 deletions
+10 -4
View File
@@ -187,7 +187,7 @@ export const fetchgeigerAVGData = async (opts) => {
let sorting = {datetime: opts.sort};
let client = await connectMongo()
try {
if(opts.mooving) {
if(opts.moving) {
docs = await client.db(MONGOBASE).collection('sensors').aggregate([
{
$sort: sorting
@@ -213,8 +213,11 @@ export const fetchgeigerAVGData = async (opts) => {
}
},
{
$project: {_id:0, cpm_avg: 1, datetime:1, uSvph_avg: { $multiply: ["$cpm_avg", opts.factor]}
}
$project: {_id:0, cpm_avg: 1, datetime:1, uSvph_avg: { $multiply: ["$cpm_avg", opts.factor]}}
},
{
$sort: {datetime: 1}
}
]).toArray();
} else {
docs = await client.db(MONGOBASE).collection('sensors').aggregate([
@@ -239,7 +242,10 @@ export const fetchgeigerAVGData = async (opts) => {
{ $addFields: { datetime: "$_id"}}, // change '_id' to 'datetime
{
$project: {_id:0, uSvph_avg: { $multiply: ["$cpm_avg", opts.factor]}, datetime: 1, cpm_avg: 1}
}
},
{
$sort: {datetime: 1}
}
]).toArray();
}
} catch(e) { // if there was an error