How to set field validation in mongodb atlas function for crud operation

I am creating a mongodb atlas function for a insert operation and I want to know how to validate the data before the insert operation. One more thing I am having issue with date as I am saving some field with date but the format I want to save is 2023-03-03T00:00:-0.000+00:00 but date is saving like this 2023-03-03T10:30:30.734+00:00 with new Date().

this function moment(new Date()).format(“YYYY-MM-DD”) is giving the format I need but mongodb taking it as string and saving it as a string.
But Mongodb taking new Date() as date but date is coming with timezones that’s I don’t need.

So I want to know how to make the date as date not as string in mongodb atlas function

Here is my sample function

exports = function () {
  const mongodb ="mongodb-atlas");
  const collection = mongodb.db("some database").collection("collection");
   collection .insertOne({
  	new_date: moment(new Date()).format("YYYY-MM-DD"),
  	next_date: new Date(),
  	createdAt: new Date(),
  	lastUpdatedAt: new Date(),
	return {
		status: "ok",