3

The documentation states equivalence for the code snippets below. But in the first case I can do operations on the documents collection inside the callback function, while the map function in the latter only works on one document. I do want to group values of the document, which I could do in the callback but not in the map function. Is there a way to accomplish this with the "JavaScript Language Integrated Query"? And how would I set the response body properly?

    __.queryDocuments(__.getSelfLink(),
          "SELECT docs.id, docs.message AS msg " +
          "FROM docs " +
          "WHERE docs.id='X998_Y998'"
        ,
        function(err, docs, options) {
          __.response.setBody(docs);
        });

and

__.chain()
    .filter(function(doc) {
        return doc.id === "X998_Y998";
    })
    .map(function(doc) {
        return {
            id: doc.id,
            msg: doc.message
        };
    })
    .value();
1
  • Problem is solved. One has to put the callback into the value function. There the error, the feed and an continuation token is provided Commented Jul 22, 2017 at 12:13

1 Answer 1

1

For those with a similar problem: see the comment above. Put the callback logic in the value function.

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.