Grant access to a document to all users

Is there a way to allow all the users to access to a specific document without knowing the users in advance?

I CAN’T do this:

if(doc.type == "document_to_share") {
    access(user, doc.channel)
}

The document must be accessible by all users by default.

Update:

From the docs: “A document tagged with * is readable by any user”

What does it mean? How can i “tag” a document with *?

@loristefano

You can map a document to the built-in public channel, the channel is accessible to all users and in the sync function is referenced as the ! channel.

if(doc.type == "document_to_share") {
   channel("!");
}
1 Like

@loristefano

Could you paste a link to the docs you referenced above with regard to “A document tagged with * is readable by any user”, I’d like to review that in context to make sure the statement is correct.

http://developer.couchbase.com/documentation/mobile/1.2/develop/guides/sync-gateway/channels/intro/index.html