Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Couchbase | Mobile

Best way to import seed data into app database

2 replies [Last post]
  • Login or register to post comments
Fri, 11/11/2011 - 04:45
subblue
Offline
Joined: 11/11/2011
Groups: None

I have a web app that has a couchdb database of about 1000 articles that I want to create a stand alone iOS app from. I'm using PhoneGap to provide the web view/app bridge.

What is the best way to bundle/seed the app's database from the master version on build? The app needs to ship with all the data and be self-contained so I don't want to sync on first start up.

Many thanks
Tom

Top
  • Login or register to post comments
Fri, 11/11/2011 - 14:17
jens
Offline
Joined: 10/04/2011
Groups: None

After you’ve created the database somewhere, find the .couch file that contains its data and add a copy of it to your project as a resource. Then at launch time, use NSBundle to look up that resource and pass the path to -[CouchbaseMobile installDefaultDatabase:].

Top
  • Login or register to post comments
Fri, 12/23/2011 - 10:31
kinkoi
Offline
Joined: 12/21/2011
Groups: None

Take a look the grocery sync example and search for "#if INSTALL_CANNED_DATABASE" in AppDelegate.m

You need to replace

[server installDefaultDatabase: dbPath];

with

[[server couchbase] installDefaultDatabase: dbPath];

https://github.com/couchbaselabs/iOS-Couchbase-Demo

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker