Syncing with couchdb : are views pulled?

20 views
Skip to first unread message

विश्वासो वासुकिजः (Vishvas Vasuki)

unread,
Jul 7, 2017, 6:28:22 PM7/7/17
to mobile-c...@googlegroups.com
Hi!

I've got a couchbase lite db, which I pull-replicate (using Java/ scala couchbase lite code) with a couchdb database. The couchdb database has some views (named _design/chapter_index ). But, from some tests (booksDb.getExistingView("chapter_index") returns null), I suspect that such views don't appear in the couchbaselite db even after syncing. 

Is this expected? Is there some way to sync such views/ indexes into couchbaselite db?

--
--
Vishvas /विश्वासः

Brendan Duddridge

unread,
Jul 8, 2017, 12:22:36 PM7/8/17
to Couchbase Mobile
Only documents are synced. You'll just have to define the same views in Couchbase Lite that you have in CouchDB. Then they'll be maintained by Couchbase Lite.

Jens Alfke

unread,
Jul 8, 2017, 4:58:17 PM7/8/17
to mobile-c...@googlegroups.com
On Jul 7, 2017, at 3:27 PM, विश्वासो वासुकिजः (Vishvas Vasuki) <vishvas...@gmail.com> wrote:
>
> I've got a couchbase lite db, which I pull-replicate (using Java/ scala couchbase lite code) with a couchdb database. The couchdb database has some views (named _design/chapter_index ). But, from some tests (booksDb.getExistingView("chapter_index") returns null), I suspect that such views don't appear in the couchbaselite db even after syncing.

Couchbase Lite doesn’t support JavaScript map functions by default; there’s an extra library you’ll need to add, which should come with it. (I’m not sure about Java, but this is true for iOS/Mac.)

Once you’ve got that set up, you need to use the right view name. Since design docs can contain multiple views, you have to use a view name that’s the design doc's ID plus a slash plus the view name. E.g. “chapter_index/someview”.

—Jens
Reply all
Reply to author
Forward
0 new messages