Quantcast
Channel: Mobile - Couchbase Forums
Viewing all articles
Browse latest Browse all 1117

I want to migrate serviceconfig.json from sync gateway 2.8 to 3.1

$
0
0

Hello,
I want to migrate serviceconfig.json from sync gateway 2.8 to 3.1.
I don’t understand the new architecture (scopes or sync)
In particular, we used the databases part and the “sync” function to filter and define channels.

I transformed the databases part like this but it doesn’t work.

"databases": {
    "nestor-referential": {
      "name": "referentialname",
      "bucket": "referential",
      "allow_conflicts": true,
      "num_index_replicas": 0,
      "revs_limit": 250,
      "enable_shared_bucket_access": true,
      "import_docs": true,
	  "scopes": {
		  "referential" : {
			  "collections": {
				  "system-user": {
					"import_filter": "function(doc, oldDoc) { if (doc.type == 'SystemUser' || doc.type == 'SystemUserSettings' || (oldDoc != null && (oldDoc.type == 'SystemUser' || oldDoc.type == 'SystemUserSettings'))) { return false; } return true; }",
					"sync": "function(doc, oldDoc){channel('system-user');}"
				  },
				  "logs": {
					"import_filter": "function(doc, oldDoc) { if (doc.type == 'Log' || (oldDoc != null && oldDoc.type == 'Log') { return false; } return true; }",
					"sync": "function(doc, oldDoc){channel('logs');}"
				  },
				  "referentials": {
					"import_filter": "function(doc, oldDoc) { if(doc.type != 'Database' && doc.type != 'Synchronisation' && (oldDoc == null || (oldDoc.type != 'Database' && oldDoc.type != 'Synchronisation'))) { return false; } return true; }",
					"sync": "function(doc, oldDoc){channel('referential');}"
				  }
			  }
		  }
	  }
    }
  },

here’s the original in 2.8 version

 "databases": {
    "nestor-referential": {
      "server": "http://localhost",
      "bucket": "referential",
      "username": "SYNC-GATEWAY",
      "password": "SYNC-GATEWAY",
      "allow_conflicts": true,
      "num_index_replicas": 0,
      "revs_limit": 250,
      "enable_shared_bucket_access": true,
      "import_docs": true,
      "feed_type": "DCP",
      "users": {
        "GUEST": {
          "disabled": true,
          "admin_channels": [ "*" ]
        }
      },
	"sync": `function (doc, oldDoc) {
          if (doc.type == "SystemUser" || doc.type == "SystemUserSettings" || (oldDoc != null && (oldDoc.type == "SystemUser" || oldDoc.type == "SystemUserSettings")))
              channel("system-user");
          else if (doc.type == "Log" || (oldDoc != null && oldDoc.type == "Log"))
              channel("logs");
	      else if(doc.type != "Database" && doc.type != "Synchronisation" && (oldDoc == null || (oldDoc.type != "Database" && oldDoc.type != "Synchronisation")))
              channel("referential");
      }`
    }
}

Can you help me?

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 1117

Trending Articles