I am using insertMany to insert about 300 documents at a time from Lamda (AWS) to MongoDB Atlas. We are using NodeJS and Mongoose. The server seems to max out at 3% CPU so I don't believe the problem described below is harware related. There are no performance suggestions from atlas either.
The issue we are having is that the time it takes to insert 300 documents is between 27 - 30+ seconds. When using aws Lamda anything over 30 seconds causes a time out.
I feel like we must be doing something incorrectly as 30 plus seconds seems to be a very long time. Each document is only 7KB.
The indexing is done with a timestamp and a string (like a URL) and unique timestamp and string combination.
There are 13,500 documents in the collection.
Any ideas how to speed this up ?