moved object id into document and forced unique constraint