Quantcast
Channel: Active questions tagged mongodb-atlas - Stack Overflow
Viewing all articles
Browse latest Browse all 271

What is MongoDB Atlas vs Realm vs Realm Sync in Swift [closed]

$
0
0

Edit: If youre going to downvote let me know what Im missing in this question. I heavily researched this and made it as clear as possible given the info I have.

Edit 2: Cleaning this up to reopen it and make it less confusing. @Jay gives the best explanation in the answers.

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)")       return   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.

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.


Viewing all articles
Browse latest Browse all 271

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>