My current key keys contain from 3 or 4 segments:
namespace::my_key::id namespace::my_key::my_second_key::id
Solution 1. Use a complex identifier and create views by searching by id for the key
function (doc, meta) { if(meta.id.indexOf("::my_key::") !== -1){ emit([doc.source_id], [doc.name,doc.title,doc.ui]); } }
Solution 2. For each document, add fields of type "type", "namespace", and types of creativity that use them
function (doc, meta) { if(doc.type=='my_key'){ emit([doc.source_id], [doc.name,doc.title,doc.ui]); } }
If I choose solution 2, I should support id in my application and probably will do the same as in solution 1.
Does anyone have experience in identifying names and creating from them? what problems you had with each of these solutions. Or maybe the indexOf () function is not recommended?
Edmhs source share