sync gateway to couchbase server data insert question
sync_gateway version 3.1
couchbase server version 7.2
bucket name: sync_test
scope name : test
collection name : sync
- test config : sgwsyncuser.json
{
"bootstrap": {
"server": "couchbases://192.168.10.137",
"username": "sync_gateway",
"password": "password",
"server_tls_skip_verify": true,
"use_tls_server": true
},
"api":{
"admin_interface": ":4985"
},
"logging": {
"console": {
"enabled": true,
"log_level": "info",
"log_keys": ["*"]
}
}
}
- create test db
curl --location --request PUT 'http://127.0.0.1:4985/syncdb/' \
--header "Authorization: Basic $DIGEST" \
--header 'Content-Type: application/json' \
--data '{
"bucket": "sync_test",
"scopes": {
"test": {
"collections": {
"sync": {
"sync": "function(doc){channel(\"collection name\");}",
"import_filter": "function(doc) { if (doc.type != 'mobile') { return false; } return true; }"
}
}
}
},
"num_index_replicas": 0
}'
- data insert curl1
curl --location --request PUT 'http://localhost:4985/sync_gateway.test.data/hotel_88802' \
--header "Authorization: Basic $DIGEST" \
--header 'Content-Type: application/json' \
--data '{
"_id": "hotel_88802",
"id": "88802",
"type": "hotel",
"name": "Verify-Install Topic",
"address": "The Shambles",
"city": "Manchester",
"country": "United Kingdom"
}'
- error message1
HTTP: c:#041 db:sync_gateway col:data PUT /sync_gateway.test.data/<ud>hotel_88802</ud> (as ADMIN)
HTTP: c:#041 db:sync_gateway col:data #041: --> 403 (126.7 ms)
- data insert curl 2
curl --location --request PUT 'http://localhost:4985/syncdb/hotel_88802' \
--header "Authorization: Basic $DIGEST" \
--header 'Content-Type: application/json' \
--data '{
"_id": "hotel_88802",
"id": "88802",
"type": "hotel",
"name": "Verify-Install Topic",
"address": "The Shambles",
"city": "Manchester",
"country": "United Kingdom"
}'
- error message2
Auth: c:#043 db:syncdb #043: User <ud>sync_gateway</ud> was successfully authorized as an admin
HTTP: c:#043 db:syncdb PUT /syncdb/<ud>hotel_88802</ud> (as <ud>sync_gateway</ud> as ADMIN)
HTTP: c:#043 db:syncdb #043: --> 404 keyspace syncdb._default._default not found (2.6 ms)