firebase-tools-ui: Firestore sub-collections with nonexistent parents are not showing in emulator

[REQUIRED] Environment info

firebase-tools: 8.4.0

Platform: macOS 10.15.4

[REQUIRED] Test case

I’ve found that when having nested collections in Firestore, they don’t display on the web interface of the emulator unless parent documents contain data.

[REQUIRED] Steps to reproduce

// create some data in a nested collection without data in the document

db.collection('stripe')
.doc('6tSfMgrOCEOi3kj0IHRivd0ZCgX2')
.collection('subscriptions')
.doc('sub_123456789').set({
    status: "active"
})

[REQUIRED] Expected behavior

On the production version of the data viewer, it displays empty documents in italics (to designate that there is no fields but sub-collections exist). Image below. Screen Shot 2020-05-24 at 8 02 36 PM

[REQUIRED] Actual behavior

There is nothing to display on the UI and I cannot access child collections. If I set some dummy data on a document, the row will appear.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 32
  • Comments: 19 (4 by maintainers)

Most upvoted comments

I’ve escalated this internally as b/152785133 and we’re actively trying to staff this fix. In the meantime, feel free to send us a Pull Request.

This is not merely an emulator UI issue.

In certain cases, the behavior of writes is different between emulators and production.

Steps to reproduce:

Perform the following write operation, on em empty database.

db.collection('one')
.doc('two')
.collection('three')
.doc('four').set({
    status: "active"
})

Expected behavior

  1. An empty document 'two., with a collection ‘three’ is created. This works perfectly in production.
  2. Reads to path “/one/two” should succeed .

Actual behavior:

  1. Document ‘two’ is not created in the emulated database.
  2. Reads to path “/one/two” fail. Document.exists returns false.

I am still facing this issue

Any Updates?

@4mitabh Just let me clarify: Even in production, the document two is not automatically created either. Reads to two always fail since two does not actually exist. There is no automatic cascading creation or deletion in Firestore.

The Firebase Console in production however shows an entry of “two” in the data viewer to help you navigate the database and find things under it. If you look closely, it also says “this document does not exist” in the panels to help clarify. This issue tracks the implementation of a similar feature to show a placeholder for such missing links in the Emulator UI.

why is this marked as solved then the issue is still not resolved