changed api from document to insert for insert operations