我可以使用MongoDB替代iOS上的CoreData吗? [英] Can I use MongoDB as a replacement for CoreData on iOS?

查看:165
本文介绍了我可以使用MongoDB替代iOS上的CoreData吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始阅读MongoDB和CouchDB等NoSQL技术。我很想知道我是否可以使用MongoDB或任何NoSQL技术来替代核心数据应用程序。

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 replacement for Core Data applications.

核心数据应用程序可能需要很长时间才能学习和实现,特别是如果你的应用程序很复杂,你只想做一些简单的添加,编辑,删除和查询(CRUD的东西)。

Core data applications can take a long time to learn and implement, especially if your app is complex and you just want to do some simple add, edits, deletes and queries (CRUD stuff).

因为它看起来像JSON和看起来喜欢它可以跑得很快;我对NoSQL over Core Data的实现感兴趣。

Because it looks like JSON and looks like it can run really fast; I'm interested in the implementation of NoSQL over Core Data.

我可以将MongoDB作为本机运行吗?我做了一些谷歌搜索,但实际上无法得到我追求的具体答案。

Can I run MongoDB as native? I did some Google searches but wasn't really able to get the specific answers I'm after.

例如:

我不确定iphone在iphone平台上有什么职权范围,是否支持,如果我提交一个带有NoSQL的应用程序,苹果团队会否认它吗?

I am not sure what the remit is for NoSQL on iphone platforms, is it supported, would it be denied by the Apple team if I submit an app with NoSQL on it?

谢谢

推荐答案

顺便说一下,我会注意到这是一个常见的误解,但核心数据不是数据库系统。

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.

核心数据确实有学习曲线,但根据我的经验,许多人面临的最大障碍是将核心数据视为某种面向对象的SQL包装器。从这个角度来看,Core Data非常令人困惑,因为它似乎需要学习很多与持久性无关的知识。

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.

使用像SQLite这样的数据库,MongoDB和CouchDB的持久性根本不会真正加快速度,因为尽管你可能更好地理解他们如何在磁盘上和磁盘上获取数据,他们根本无法帮助管理数据以及与其他数据对象和UI对象的关系。你仍然需要一个数据模型,你必须手动编写所有这些。除非您的数据模型非常简单,否则比学习核心数据需要更多时间。

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.

这篇关于我可以使用MongoDB替代iOS上的CoreData吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆