Use BSON.Date or IsoDate in Realm

Hey,

I’m calling an endpoint with a realm function that insert into a collection. I pass a date as IsoString and would like it stored as with datetime:

Ex of how date 2018-01-01T18:25:00.000+00:00 is stored with datetime

{
  "date": {
    "$date": {
      "$numberLong": "1514831100000"
    }
  },
  "duration": "1.5",
   ...
}

If I just create a Date object I get

{
"date": "Mon Aug 15 02:15:00 GMT-04:00 2022",
  "duration": "0.5",
}

I would like to be able to use BSON.Date() or BSON.IsoDate()

Also if someone could answer the question: why is Realm so different from what you can do in MongoShell, it’s such a pain