What is MongoDB Atlas vs Realm vs Realm Sync in Swift

What is the difference between MongoDB Atlas and Realm Sync? The following tutorial shows using documents to do CRUD operations, this makes sense to me, and seems to be the basic MongoDB implementation. The documentation says that is does not access Realm, and you are not accessing Atlas Device Sync directly. https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/app-services/mongodb-remote-access/

let queryFilter: Document = ["name": "Americano"]
let findOptions = FindOptions(0, nil, [["beanRegion": 1]])

collection.find(filter: queryFilter, options: findOptions) { result in
   switch result {
   case .failure(let error):
       print("Call to MongoDB failed: \(error.localizedDescription)")
   case .success(let documents):
       print("Results: ")
       for document in documents {
           print("Coffee drink: \(document)")

That feels pretty straight forward. There are clear commands for adding and deleting data and accessing specific documents.

Then there is Realm. I have used this before for local persistance, and that I do understand. Its usually something like this :

try! realm.write {
   //Modify Node here

There are write, delete, etc commands. It doesn’t need MongoDB at all (im 99% sure)

However, then there is flexible sync: https://www.mongodb.com/docs/atlas/app-services/tutorial/swiftui/ Is this the same as Atlas Device Sync and Realm Sync?

let config = user.flexibleSyncConfiguration(initialSubscriptions: { subs in
  if let foundSubscription = subs.first(named: Constants.myItems) {
     foundSubscription.updateQuery(toType: Item.self, where: {
        $0.owner_id == user.id && $0.priority <= PriorityLevel.high
  } else {
     // No subscription - create it
     subs.append(QuerySubscription<Item>(name: Constants.myItems) {
        $0.owner_id == user.id && $0.priority <= PriorityLevel.high
}, rerunOnOpen: true)

This I found confusing because you do not have any specific write commands, you have subscriptions. Except in all the example, they do not access a database by name. I downloaded and created the example app. It successfully updates to a database in my cluster labeled “todo” out of the 3 databases i have. Nowhere in my app do i have anything that says “todo”, so im not sure where this connection magic is happening.

What it looks like to me, is that flexible sync is when a user might need to see other users data, very quickly. For instance, flexible sync would make a lot of sense for a messaging app. For a private blog app where you only see your own posts, however, it feels like this may not be necessary.

So should I be using flexible sync and mongoDB together? Is there something between them that has more capability than MongoDB (The documentation makes it seems like this isnt something you would usually use) but does do as much processing at Realm Sync? I have spent genuinely 2 weeks studying this and cannot find a source of truth on it.