collection: do getlasterror and allow out param for result document.