Improved the `ids` query

* Type is an optional argument
* IDs argument is converted to Array

Closes #751