# In deviceauth what does the function GetDeviceStatus do?

**URL:** <https://hub.mender.io/t/in-deviceauth-what-does-the-function-getdevicestatus-do/260>\
**Category:** General Discussions\
**Created:** [February 25, 2019, 10:34pm UTC](https://hub.mender.io/t/in-deviceauth-what-does-the-function-getdevicestatus-do/260 "2019-02-25T22:34:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bbbh](https://avatars.discourse-cdn.com/v4/letter/b/5e9695/32.png) [@bbbh](https://hub.mender.io/u/bbbh)\
**Post date:** [February 25, 2019, 10:34pm UTC](https://hub.mender.io/t/in-deviceauth-what-does-the-function-getdevicestatus-do/260/1 "2019-02-25T22:34:50Z")

</div>

It seems it takes in the device id and queries mongo but filters by the deviceid, so it should only ever return one result right? then map reduce just makes it so if there are more than one returned take the sum of the status. but then why run a for loop on the return. technically there should only be ever one returned result making mapreduce not needed or am i missing something?
