Fetching value from config db in Provisioning script


Is there a way to read the value from config collection from either from provision or external script.

Actually I wanted to compare a value that I configured in config collection against the value reported by the device.

Requirement is i will configure Device latest version as x in config collection through admin tab->config page->new config; Wanted to read this x from DB and compare it with value reported by Device reported swversion;

If i see a difference will send download request to device through download api.

Please suggest me a way to achieve it.

Note ; Was able to get value from device and send download request (with hardcoded value) in provision script. ; Only part pending is reading the latest version from DB.

@akcoder @zaidka - Kindly provide your suggestion