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

前端 未结 8 1375
名媛妹妹
名媛妹妹 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 19:02

    MongoDB is not designed to be used as an embedded database. It is designed for speed and scalability and unlikely fits the architecture of an embedded OS like IOS. However talking to some MongoDB-backed service in the "cloud" through standard protocols like HTTP/S should not be an issue. You just need to write some web-gateway in front of MongoDB.

    0 讨论(0)
  • 2021-02-01 19:07

    For this, I recommend ObjCMongoDB. Is a library for MongoDB and BSON:

    https://github.com/paulmelnikow/ObjCMongoDB

    Features

    • Simple BSON encoding and decoding, using dictionaries.

    • Built-in support for arrays, dictionaries, embedded objects, strings, numbers, dates, object IDs, and the miscellaneous MongoDB types.

    • More complex encoding and decoding based on NSCoder's keyed coding scheme. A robust delegate interface lets you implement encoding and decoding entirely outside the model classes if necessary.

    • Automatically encodes and decodes Core Data entities. Using the coder's delegate interface you can customize the default behavior, or simply implement alternate behavior it in the entity class.

    • Aims to feel Cocoa-like, not Mongo-like. For example, method names in MongoKeyedPredicate and MongoUpdateRequest are natural in Cocoa, though they don't conform to the underlying Mongo keywords.

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