开发者

Best approach to sync mongodb database with local serialized version

开发者 https://www.devze.com 2023-01-30 09:35 出处:网络
I am developing a mac application, using objective-c and the native tools.I love mongodb\'s document based implementation and I plan to use it to store the data for my application (the data will more

I am developing a mac application, using objective-c and the native tools. I love mongodb's document based implementation and I plan to use it to store the data for my application (the data will more or less be the title of music track, with its accompanying metadata). The aim of the application is to allow users to be able to sync up the database version of the database, to their local version. And then, be able to always have a local version on their computer, so the internet wouldn't be needed to use the application. But if the user was offline, and made changes to their local data, when they get back online the changes would be synced back up to the mongodb database. The problem I'm having is finding the best approach to this problem. The best I can think of right now, is to initially pull the data from the database and serialize local copies of each "music track" entry in the database. So when offline, the problem would populate data from these serialized objects. If the user added/changed data offline, the changes would be noted, and would wait to be pushed to the mongodb database when the user got back online. All entries in the mongodb database would be timestamped, so when the application was running online, every few seconds, the application could compare timestamps from its local copy and remote copy to see if changes have been made, and update accordingly.

Is this a good approach to syncing up data remotely an开发者_开发知识库d locally from a mongodb database?


This is a very interesting question and sadly I don't have a great answer for it (nor does it seem others do at this point.)

However, you might be interested in this recent presentation from MongoSV on Using MongoDB With iOS ...

http://www.10gen.com/video/mongosv2010/ios

In the presentaion Tim Burks mentions some projects he's working on for storing MongoDB data on iOS devices, it might be some help to you.

He mentions Tokyo Cabinet for example ... you could in theory store BSON/JSON structure in SQLite (a little weird, but doable.)

0

精彩评论

暂无评论...
验证码 换一张
取 消