11 lines
441 B
JavaScript
11 lines
441 B
JavaScript
import {SensorDataCollection} from "../../client/main";
|
|
|
|
// Fetch all esp-IDs stored in all documents of the sensorData collection and remove duplicates,
|
|
// returning an array of esp-IDs that have sent data to the database.
|
|
export function getAllEspIds() {
|
|
return _.uniq(SensorDataCollection.find({}, {
|
|
sort: {device_id: 1}, fields: {device_id: true}
|
|
}).fetch().map(function (x) {
|
|
return x.device_id;
|
|
}), true);
|
|
} |