Skip to content

Commit

Permalink
CBG-2916 Add database examples with scopes (#6233)
Browse files Browse the repository at this point in the history
  • Loading branch information
torcolvin committed May 11, 2023
1 parent 2a9837d commit 3beea7d
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
38 changes: 38 additions & 0 deletions examples/database_config/collections-with-custom-scope.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "db",
"bucket": "bucket",
"scopes" : {
"scope1": {
"collections": {
"collection1" : {
"sync": `
function(doc, oldDoc, meta) {
if (doc.type != "default") {
throw({forbidden : "Rejected document"})
}
channel("legacy")
}
`,
"import_filter": `
function(doc) {
return doc.type == "mobile"
}
`
},
"collection2" : {
"sync": `
function(doc, oldDoc, meta) {
channel("collection1")
}
`,
"import_filter": `
function(doc) {
return doc.type == "mobile"
}
`
}
}
}
},
"num_index_replicas": 0
}
38 changes: 38 additions & 0 deletions examples/database_config/collections-with-default-collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "db",
"bucket": "bucket",
"scopes" : {
"_default": {
"collections": {
"_default" : {
"sync": `
function(doc, oldDoc, meta) {
if (doc.collection != "default") {
throw({forbidden : "Rejected document"})
}
channel("legacy")
}
`,
"import_filter": `
function(doc) {
return doc.type == "mobile"
}
`
},
"collection1" : {
"sync": `
function(doc, oldDoc, meta) {
channel("collection1")
}
`,
"import_filter": `
function(doc) {
return doc.type == "mobile"
}
`
}
}
}
},
"num_index_replicas": 0
}

0 comments on commit 3beea7d

Please sign in to comment.