3

我正在我的客户端设备上收集一些分析数据,这些数据不需要来自服务器数据库的任何初始数据。

是否可以从一个空数据库开始,添加一些分析文档,然后当我准备好使用推送复制通过同步门将这些文档添加到我的服务器数据库中?

我将拥有一个分析通道,但我不想从该通道中提取所有内容到我的客户端数据库中,因为它不关心已经存在的内容,它只想添加它。

我会在 Couchbase 论坛上问这个问题,但它目前已关闭。

4

2 回答 2

1

当然,推送和拉取复制是完全独立的,只要您不创建拉取复制,您就不会从同步网关接收任何数据。

于 2015-05-07T09:37:08.013 回答
0

使用以下 APICBLDatabase将数据上传到服务器。

/** Creates a replication that will 'push' this database to a remote database at the given URL.
    This always creates a new replication, even if there is already one to the given URL.
    You must call -start on the replication to start it. */
- (CBLReplication*) createPushReplication: (NSURL*)url;

这是一个如何设置推送复制的示例。

NSURL* url = [NSURL URLWithString: @"https://example.com/mydatabase/"];
CBLReplication *push = [database createPushReplication: url];
push.continuous = YES; // NO for One-shot replication
//After authenticating and adding progress observers here, call -start
[push start];

您可以使用类似的方式设置拉复制(如果需要)-createPullReplication:。在此处阅读更多文档 -复制

于 2015-08-10T10:14:50.357 回答