Skip to content

__name__ beeing stripped from firestore:indexes cmd #8758

Closed as duplicate of#7629
@glumb

Description

@glumb

Why it matters
The issue is that some queries require a non standard __name__ sorting, like

const query = await db.collection("Auditlog")
  .where("tenantID", "in", ["IeZfE0yKWs0kGBl1IG5M"])
  .orderBy("_meta.dateCreated", "desc")
  .limit(50)
  .get();

wants me to create this index (maybe this is another bug? as I read that the name shall automatically sort according to the last sort in the index)

Image

When I now create this index online in the firebase console, download the indexes via the client and redeploy them to another project, the __name__ sorting information got lost, as its now creating an index sorting by DESCENDING for __name__

[REQUIRED] Environment info

firebase-tools: 14.7.0

Platform: macOS

[REQUIRED] Test case

just call firebase firestore:indexes. the __name__ field is stripped

[REQUIRED] Steps to reproduce

  1. have an index in firestore
  2. call firebase firestore:indexes.
  3. the __name__ field is stripped

[REQUIRED] Expected behavior

__name__ is present

[REQUIRED] Actual behavior

the __name__ field is stripped due to

// Ignore any fields that point at the document ID, as those are implied
// in all indexes.
const fields = index.fields.filter((field: types.IndexField) => {
return field.fieldPath !== "__name__";
});

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions