# Optimize the code

**URL:** <https://forum.genieacs.com/t/optimize-the-code/6849>\
**Category:** Uncategorized\
**Created:** [May 13, 2025, 12:50am UTC](https://forum.genieacs.com/t/optimize-the-code/6849 "2025-05-13T00:50:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lucy](https://avatars.discourse-cdn.com/v4/letter/l/e47774/32.png) [@Lucy](https://forum.genieacs.com/u/Lucy)\
**Post date:** [May 13, 2025, 12:50am UTC](https://forum.genieacs.com/t/optimize-the-code/6849/1 "2025-05-13T00:50:02Z")

</div>

I’m using version 1.2.9. In the fetchDevice function, it’s querying by ID to retrieve all device information, but that increases the system’s bandwidth usage. Is it possible to retrieve only the necessary information instead of fetching everything?"

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [May 13, 2025, 5:12pm UTC](https://forum.genieacs.com/t/optimize-the-code/6849/2 "2025-05-13T17:12:44Z")

</div>

What are you actually trying to do? You appear to be trying to consume a function internal to GenieACS.

If you are trying to query GenieACS from an external system, only the [API](https://docs.genieacs.com/en/latest/api-reference.html) will is supported.

---

<div class="post-metadata">

**Author:** ![Lucy](https://avatars.discourse-cdn.com/v4/letter/l/e47774/32.png) [@Lucy](https://forum.genieacs.com/u/Lucy)\
**Post date:** [May 19, 2025, 1:32am UTC](https://forum.genieacs.com/t/optimize-the-code/6849/3 "2025-05-19T01:32:32Z")

</div>

Yes, that’s correct. I intend to modify the `fetchDevice` function within GenieACS to limit the data retrieved from MongoDB for each device. There are certain fields that I never need to update, so excluding them should help reduce bandwidth consumption. `fetchDevice` function is invoked within the CWMP interface, not the NBI.
