Add example for use of callback function in queryToArray function

Added an example on how to use the newly added Callback function
capability of the queryToArray function.