I have this ViewDefinition
:
""" Models id."""
models = ViewDefinition('models', 'by_authors', """
function(doc) {
if (doc.type == "definition") {
for (var i = 0; i < doc.authors.length; i++) {
var author = doc.authors[i];
emit(author, doc._id);
}
}
}""")
I am calling it like so:
models = []
for principal in principals:
models += [d.value for d in views.models(self._db)[principal].rows]
return list(set(models))
How can I ask for a list of keys instead and call it like:
models = [d.value for d in views.models(self._db)[*principals].rows]
Well the solution is quite simple also I had to read the source code to be able to find it.
models = [d.value for d in views.models(self._db, keys=principals).rows]