Courseiva

PCDE Practice Question: Manage a solution that can span multiple database technologies

A team is using Firestore in Native mode. They have a collection 'users' with an array field 'roles'. They need to query all users where roles contains 'admin'. What index configuration is required?

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Create an index exemption on the 'roles' field.

Firestore supports array membership queries using the 'array-contains' operator. An index exemption for the array field is required because Firestore does not automatically index array fields for array-contains queries. The exemption is created manually.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Create a single-field index on roles with ascending order.

    Why it's wrong here

    A single-field index does not support array-contains; an exemption is needed to override the default no-index for arrays.

  • Create an index exemption on the 'roles' field.

    Why this is correct

    Correct. An index exemption is required for array fields to support array-contains queries.

  • Create a composite index on roles and the default field.

    Why it's wrong here

    Array-contains queries require a single-field index exemption for the array field, not a composite index.

  • No index is needed; Firestore automatically supports array-contains queries.

    Why it's wrong here

    Firestore does not automatically index array fields for array-contains; an index exemption is needed.

About these practice questions

This PCDE question is part of Courseiva's 1,446-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This PCDE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCDE exam.