0

I have a structure of Firestore in which one of the fields is an array of maps. I want to filter the search by one of the keys of these maps. The structure is as follows:

uid: "g9x08Ozdu"
title: "some title"
timestamp: 1670743255138535 
urls:
    [
      {type: "photo", name: "john"},
      {type: "video", name: "smith"},
      {type: "photo", name: "tom"},
    ]
.
.
.

I want to filter all the collection and only get the documents in which any of the elements of urls has the type "photo"? Is something like this possible? Thanks in advance!

sm_sayedi
  • 326
  • 2
  • 17
  • 1
    As you’ll see in the duplicate you cannot query an array of objects to check if it contains an item with a specific value for a property. I suggest to have a set of extra fields in your document as follows based on your example: photo = true and video = true. – Renaud Tarnec Mar 25 '23 at 08:44

0 Answers0