Bookworm-project / BookwormDB

Tools for text tokenization and encoding
MIT License
84 stars 12 forks source link

Sensibly handle arrays passed to string fields in category creations. #42

Open bmschmidt opened 10 years ago

bmschmidt commented 10 years ago

This is the inverse issue of issue 36.

If someone passes an array to a field where a list is expected, what should be done? Currently we die; but again, that sucks for such a common problem.

My proposal in this case would be to do a join on the passed fields into a string: so if {"unique":true} for persons, but someone passes in ["Obama","Bush"], we could store a value of Obama--Bush calculated as

"--".join(input)

This might leave people confused about what happened, but would often produce relatively sensible results.