Convert a Document to a HashBag/Bag structure

Also does type coercion for Bool/Long/Double/null values, instead of leaving them as String