Create new channel dynamically( in sync function) and assign to documents

Is its possible to create new channel with currentDate as channel name (ex: ‘2017-06-30’) and assign documents to that new channel which get created on that date?

Our scenario is all the users has access to all documents but to limit the data on the tablet, we want to establish the documents based on date, so that on Couchbase Lite we will pull based on channel name.


try something like this.

  var today = new Date(); //make date
  var d = today.getDate()
  var y = today.getFullYear()
  var m = today.getMonth()
  console.log(y+"-"+m+"-"+d) //write to Sync Gateway log

1 Like