How can I get local couchbase lite docs using View?

I have created some couchbase lite local docs and trying to access those using a CBL view.

clients: {
map: function(doc) {
if (doc.type === “client”) {
emit(doc._id, doc);
}
}.toString(),
},

But the above view is just returning all the docs which are synced from Couchbase sync gateway but not the local docs.

Should I need to made changes to the view to get all the docs including local docs?

Local docs cannot be queried as normal docs are. I would suggest making a separate database for them and making normal documents and just don’t do any replication.

By “local docs” do you mean regular documents created on-device, or via the “local document” API?

The “local document” API creates docs in a separate store that are not queryable. It’s a holdover from CouchDB and not used much; in CBL 2 we’ve gotten rid of that feature.

If you have documents you don’t want replicated, you can create a separate database for them and just don’t replicate that database.

thanks @jens I will check this