update the counter for inserting new document