Added unique flag to flattenArray

Signed-off-by: Tom Wright <tom@inflatablecookie.com>
Added basic union query support

Signed-off-by: Tom Wright <tom@inflatablecookie.com>