1

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]

1 Answer 1

0

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]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.