Best way to save data from iOS app?

There are multiple ways of saving data when using MongoDB Atlas and App services from a SwiftUI app -

  1. using " realm.write"
  2. using wrapped value of an " @ObservedRealmObject"
  3. direct to Atlas - collection.insert

which is the right way and are there any differences among these methods?