Fix 500 when POSTing an empty list + prevent crash in case of invalid mongo operation