question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat(query): support FieldsPath.documentId in where

See original GitHub issue

Do you want to request a feature or report a bug?
bug

What is the current behavior? Firestore gives you chance to use :

db
   .collection('books')
   .where(FieldPath.documentId(), '==', 'fK3ddutEpD2qQqRMXNW5')
   .get()

But I cant use FieldPath.documentId in:

firestore.setListener({
  collection: ...,
  where: [  FieldPath.documentId(), '==', 'fK3ddutEpD2qQqRMXNW5' ], 

I have to hack it with:

firestore.setListener({
  collection: ...,
  where: ['__name__',  '==', 'fK3ddutEpD2qQqRMXNW5' ], 

What is the expected behavior? To be able to write:

firestore.setListener({
  collection: ...,
  where: [  FieldPath.documentId(), '==', 'fK3ddutEpD2qQqRMXNW5' ], 

Which versions of dependencies, and which browser are affected by this issue? Did this work in previous versions or setups? redux-firestore@0.6.0 Steps to reproduce and if possible a minimal demo of the problem via codesandbox or similar.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
leoxs22commented, Jan 2, 2020

This feature would be great for getting several documents.

For example:

where: [FieldPath.documentId(), "in", [2,5,9]]

2reactions
alexsandscommented, May 1, 2020

Thanks for the replies! @sreeharicubet I was using that to begin with, and it worked, but realized a bit later that in queries are limited to 10. So ended up going with this, which seems to accomplish what I was hoping for (and no 10 limit):

import { useFirestoreConnect } from 'react-redux-firebase';

useFirestoreConnect((userBooks).map(bookId => ({
  collection: 'books',
  doc: bookId,
})));
Read more comments on GitHub >

github_iconTop Results From Across the Web

Firebase FieldPath.documentId() where query issue
You can't access FieldPath as a property of the db instance. Without seeing what's in ../firebase/init , it's not possible to say for...
Read more >
FieldPath - Firebase - Google
Returns A special sentinel FieldPath to refer to the ID of a document. It can be used in queries to sort or filter...
Read more >
cloud_firestore 0.14.3+1 | Flutter Package - Pub.dev
mergeFields; FEAT [WEB] adds GetOptions support for querying against server/ ... DEPRECATED: documentID has been deprecated in favor of id . ... FieldPath...
Read more >
Node / Firestore query on auto-ID returns "no documents found"
Can you provide the reproduction here or tell me the ticket number you have with support? To be clear FieldPath.documentId() is nothing more...
Read more >
Migration Guide | FlutterFire
CHORE: migrate to platform interface. FEAT: support multiple firebase apps. RemoteConfig.instanceFor() can be used to retrieve an instance of RemoteConfig for a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found