Platform View Compatibility

29 views
Skip to first unread message

Ken Courville

unread,
Dec 19, 2014, 8:25:15 AM12/19/14
to mobile-c...@googlegroups.com
Hello,

As far as I can tell, views added to a cblite file and updated on one platform (say .NET) cannot operate at all on another platform (Android).  Is this a correct statement, or am I missing something?

Zack Gramana

unread,
Dec 19, 2014, 10:15:50 AM12/19/14
to <mobile-couchbase@googlegroups.com>
They should be portable. If you find otherwise, please file Github issue.


On Dec 19, 2014, at 9:47 AM, Ken Courville <krcou...@gmail.com> wrote:

Hello,

As far as I can tell, views added to a cblite file and updated on one platform (say .NET) cannot operate at all on another platform (Android).  Is this a correct statement, or am I missing something?

--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/c7b289f9-170a-4f33-a35f-932bd803845e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jens Alfke

unread,
Dec 19, 2014, 11:39:51 AM12/19/14
to mobile-c...@googlegroups.com

On Dec 19, 2014, at 5:25 AM, Ken Courville <krcou...@gmail.com> wrote:

As far as I can tell, views added to a cblite file and updated on one platform (say .NET) cannot operate at all on another platform (Android).  Is this a correct statement, or am I missing something?

Are you talking about copying a database file from one device to another? Generally we don't support that between platforms, mostly because the codebases don't necessarily have the identical SQLite schema.

But there should be almost no reason to copy database files. Use replication instead.

—Jens

Zack Gramana

unread,
Dec 19, 2014, 11:56:13 AM12/19/14
to <mobile-couchbase@googlegroups.com>
In the 1.0.4 release, both .NET and Java should have the same schema as iOS.

--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchba...@googlegroups.com.

Zack Gramana

unread,
Dec 19, 2014, 12:00:33 PM12/19/14
to <mobile-couchbase@googlegroups.com>
The common use case here would be shipping a baseline database snapshot in order to enable a first run experience that doesn't require an initial sync in order to be usable, and/or to avoid a full enumeration of a very large dataset.

In that case, it would be natural to ship the same snapshot on all platforms an app is targeting.


> On Dec 19, 2014, at 11:39 AM, Jens Alfke <je...@couchbase.com> wrote:
>

Jens Alfke

unread,
Dec 19, 2014, 2:33:10 PM12/19/14
to mobile-c...@googlegroups.com

On Dec 19, 2014, at 9:00 AM, Zack Gramana <za...@couchbase.com> wrote:

In that case, it would be natural to ship the same snapshot on all platforms an app is targeting.

OK, that makes sense. I hadn't thought of that case.

Anyway, about the original question: Yes, views are compatible between platforms, as long as you make sure that each platform's map block/function has the same behavior, and is registered with the same version string.

—Jens

Ken Courville

unread,
Dec 20, 2014, 4:06:24 AM12/20/14
to mobile-c...@googlegroups.com
Yup. That's exactly what we're looking for.  We have .NET servers and want to provide the initial database, all in one file, based on the customers current dataset (which is in constant flux naturally), without having to download and insert batches of records.  Their datasets ranges from a few thousand to a couple hundred thousand documents.  In this scenario, processing and downloading a single file is much faster than streaming thousands of inserts over the internet.

And if the views can be initialized on the server side, where there's more computing power, even better!

So, if I understand right, I need to ensure I use the 1.0.4 release of Android CB Lite. For .NET, I the latest tag is 1.0.0. Should I use that one or master? We will be adding in iOS support soon, too. So that's good to know as well.

Also, I do need to ensure that the map block is included on all platforms.  So, if I emit something like '["@{doc.type}", "@{doc.id}"]' on the server, then I also need to emit that same string value on corresponding clients.

Zack Gramana

unread,
Dec 20, 2014, 12:09:40 PM12/20/14
to <mobile-couchbase@googlegroups.com>
The .NET 1.0.4 release will be coming out shortly, but yes, that fix is in master (which 1.0.4 will be cut from).

And yes, the output from your mapper and/or reducer functions, and the version string you pass to `SetMap` for your view must be identical on all platforms for the views to work correctly.
--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchba...@googlegroups.com.

Jens Alfke

unread,
Dec 22, 2014, 12:13:18 AM12/22/14
to mobile-c...@googlegroups.com

On Dec 20, 2014, at 1:06 AM, Ken Courville <krcou...@gmail.com> wrote:

Also, I do need to ensure that the map block is included on all platforms.  

Not quite sure what you're getting at here. The map block has to be registered at runtime for view indexing to work; else you'll get a fatal error if the view is queried and needs to be re-indexed. You'll have to ensure that the map blocks have the same behavior, whichever platform they're implemented on.

So, if I emit something like '["@{doc.type}", "@{doc.id}"]' on the server, then I also need to emit that same string value on corresponding clients.

That's not a string, it's an expression. I thought at first it was Objective-C, but it looks like it isn't; are the @ signs part of some other string formatting syntax?

The important thing here is that this view emits the doc's "type" property as the key and the "id" property as the value. The map blocks you define on any platform need to do the same thing.

—Jens

Ken Courville

unread,
Dec 22, 2014, 7:59:55 AM12/22/14
to mobile-c...@googlegroups.com

That was my attempt at pseudo coding the output.

Based on this discussion, I feel my questions are answered.

Thanks for your help!

--
You received this message because you are subscribed to a topic in the Google Groups "Couchbase Mobile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mobile-couchbase/2Mva62TRrew/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mobile-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/06CAD637-3C19-4FEA-B4D5-5356CCFE8DF4%40couchbase.com.
Reply all
Reply to author
Forward
0 new messages