Can I use MongoDB as a replacement for CoreData on iOS?

前端 未结 8 1374
名媛妹妹
名媛妹妹 2021-02-01 18:32

I\'m just starting to read up on NoSQL technologies such as MongoDB and CouchDB. I\'m interested in knowing whether I can use MongoDB or indeed any NoSQL technology as a replace

相关标签:
8条回答
  • 2021-02-01 18:41

    CouchDBX http://www.couchone.com/get is a Cocoa application that bundles CouchDB into an OSX app if that is what you are looking for

    0 讨论(0)
  • 2021-02-01 18:43

    MongoDB Mobile is an smaller version of the MongoDB database, optimized to run on mobile and IoT devices.

    MongoDB Mobile comprises two core pieces:

    A mobile-optimized version of the MongoDB database that runs locally on the device, enabling offline access to data. Native Java (Android) and Swift (iOS) SDKs that manage the lower-level database operations and provide methods to interact with MongoDB Mobile and the Stitch backend.

    https://docs.mongodb.com/stitch/mongodb/mobile/mobile-features/

    0 讨论(0)
  • 2021-02-01 18:45

    I know that this is a really old question, but I thought I would offer an answer anyway. Couchbase has a suite of software called SyncPoint, which includes TouchDB, which is a build of CouchDB built to run on iOS natively and synchronize itself with any Internet accessible CouchDB instance.

    0 讨论(0)
  • 2021-02-01 18:50

    MongoDB is probably not a good fit here. The server assumes that disk space is not a limiting factor. The current stabel brance (1.6.x) does not provide data durability on a single instance. It also uses memory mapped files which are fine on dedicated servers but will cause lots of disk churn and unnecessary memory use on a typical PC. I have no experience with Core Data, but it sounds like a septate niche to me.

    0 讨论(0)
  • 2021-02-01 18:51

    As an aside, I will note that it's a common misperception but Core Data is not a database system.

    Instead, it is a runtime object graph management system with persistent tacked on as option if you want it. It's primary function is to provide the model layer of the Model-View-Controller design pattern. As such, it deals with a lot more than just getting data on and off a disk.

    Core Data does have a learning curve but in my experience the biggest obstacle many face is trying to treat Core Data as some kind of object oriented wrapper around SQL. From that perspective Core Data is very confusing because it seems to require to learn so much that has nothing to do with persistence.

    Using database like SQLite, MongoDB and CouchDB for persistence won't really speed things along at all because, although you might better understand how they get data on and off the disk, they won't help at all in managing the data and the relationship to the other data objects and the objects of the UI. You still have to have a data model and you will have to code all that up by hand. Unless your data model is extremely simple, that will take more time than learning Core Data.

    The best way to learn Core Data is to ignore the fact that the object graph can be persisted at all. Just start from the perspective that you've got a lot of objects that represent the data model of you app and you have to manage their attributes and relationships.

    0 讨论(0)
  • 2021-02-01 18:52

    Good question. Core Data is tied to schemas and migrations so it's pointless to use it with a NoSQL database.

    I haven't tried any of these yet, but there are some claimed solutions out there:

    • Mobile Couchbase seems to be dead but Couchbase are working on TouchDB — looks promising, from a big player
    • IRL Gaming seems to have made their own (not open source) (maybe Titanium specific)
    • If you're OK with a key/value store, there's TSDocDB based on Tokyo Cabinet and NuLevelDB based on LevelDB.

    Definitely check those out.

    0 讨论(0)
提交回复
热议问题