DeviceDataDatabase

DeviceDataDatabase

Manages the database storage for DeviceData objects.

Constructor

new DeviceDataDatabase()

Source:
Implements:
  • DatabaseInterface

Methods

(async, static) create(device_id, data) → {Array}

Source:
Creates a new device data object.
Parameters:
Name Type Description
device_id string The id of the device the data belongs to.
data Object The data being reported by the device.
Returns:
Type
Array

(async, static) getByDevice(device_id) → {Object}

Source:
Retrieves all device data for a device.
Parameters:
Name Type Description
device_id string The id of the device.
Returns:
The data belonging to the given device.
Type
Object

(async, static) getByDeviceDataRun(device_id, data_run) → {Object}

Source:
Retrieves all device data for a device for a specific data_run.
Parameters:
Name Type Description
device_id string The id of the device.
data_run number The data_run to obtain
Returns:
The data belonging to the given device for the data_run.
Type
Object

(async, static) getCollection(device_id) → {Object}

Source:
Helper function to get the collection of devices.
Parameters:
Name Type Description
device_id string the id of the device whose data is being accessed.
Returns:
The MongoDB collection for devices
Type
Object

(async, static) owns(device_id, user) → {boolean}

Source:
Determines if user owns the DeviceData with id
Parameters:
Name Type Description
device_id string The id of the device to check for ownership.
user Object The user to check for ownership.
Returns:
True if the user does own the device, false otherwise.
Type
boolean