I found the following solution on Stackoverflow and it works but I didn't understand how sed worked. Can anyone please elaborate the regex function in the following command.
mongoexport --db db_name --collection collection_name | sed '/"_id":/s/"_id":[^,]*,//' > file_name.json