Mongo will create a collection (and database) if the target does not exist, obviously given user permissions without notification.
From your logs originally it does seem that mongo is reporting a success return code and giving you the ObjectID of the document that’s been inserted.
From the last code fragment, I cannot see anything wrong, maybe someone else can see something that I seem to be missing. If you check with Compass can see you see anything strange?

1 Like