nerdexam
Google

PROFESSIONAL-CLOUD-DEVELOPER · Question #83

Your teammate has asked you to review the code below. Its purpose is to query account entities in Cloud Datastore for those with a balance greater than 10000 and an age less than 4. Which improvement

The correct answer is D. Send two queries-one for balances over 10000, and another for ages less than 4-and compute. A is not correct because the stated goal doesn't require an ancestor query. B is not correct because no data is being written, so a transaction isn't necessary. C is not correct because it wouldn't affect the results. D is correct because two inequality comparisons aren't permitt

Developing applications with Cloud Datastore

Question

Your teammate has asked you to review the code below. Its purpose is to query account entities in Cloud Datastore for those with a balance greater than 10000 and an age less than 4. Which improvement should you suggest your teammate make? Captionless Image

Options

  • AThe query needs to have an ancestor query.
  • BThe query should be performed in a transaction.
  • CChange the argument to OrderBy.desc to be "balance" instead of "age."
  • DSend two queries-one for balances over 10000, and another for ages less than 4-and compute

How the community answered

(42 responses)
  • A
    14% (6)
  • B
    2% (1)
  • C
    7% (3)
  • D
    76% (32)

Explanation

A is not correct because the stated goal doesn't require an ancestor query. B is not correct because no data is being written, so a transaction isn't necessary. C is not correct because it wouldn't affect the results. D is correct because two inequality comparisons aren't permitted in a Datastore query and it requires two queries to be merged.

Topics

#Cloud Datastore#Query Limitations#NoSQL Queries#Application Development

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-CLOUD-DEVELOPER Practice