I try to get only object value that I want but whenever I query with array-contains in where() ,come out all data value from that collection.
getid Array [
Object {
"timestamp": Object {
"nanoseconds": 738000000,
"seconds": 1639994269,
},
"userMatch": Array [
"6Lf5bHwzCSbI2bmoMv7KuduMGwe2",
"E8R52y6dD8XI3shXhnhS9pVzUpe2",
],
"users": Object {
"6Lf5bHwzCSbI2bmoMv7KuduMGwe2": Object {
"about": "gshjs",
"age": "25",
"displayName": "ry",
"gender": "female",
"id": "6Lf5bHwzCSbI2bmoMv7KuduMGwe2",
"interestIn": "male",
"job": "fh",
"photo": "https://firebasestorage.googleapis.com/v0/b/match-me-now.appspot.com/o/images%2F6Lf5bHwzCSbI2bmoMv7KuduMGwe2%2FprofilePicture.jpeg?alt=media&token=e1b8d794-4074-4e10-93f1-e2f5c9835fa2",
"timestamp": Object {
"nanoseconds": 44000000,
"seconds": 1639994173,
},
},
"E8R52y6dD8XI3shXhnhS9pVzUpe2": Object {
"about": "fdhnsn",
"age": "25",
"displayName": "gsj",
"gender": "male",
"id": "E8R52y6dD8XI3shXhnhS9pVzUpe2",
"interestIn": "female",
"job": "hsh",
"photo": "https://firebasestorage.googleapis.com/v0/b/match-me-now.appspot.com/o/images%2FE8R52y6dD8XI3shXhnhS9pVzUpe2%2FprofilePicture.jpeg?alt=media&token=b93935cf-8285-4059-8495-2243fdb89fff",
"timestamp": Object {
"nanoseconds": 201000000,
"seconds": 1639994235,
},
},
},
},
]
I only want is userMatch (E8R52y6dD8XI3shXhnhS9pVzUpe2) id value
"userMatch": Array [
"6Lf5bHwzCSbI2bmoMv7KuduMGwe2",
"E8R52y6dD8XI3shXhnhS9pVzUpe2",
],
I fetch as follow
useEffect(async()=>{
const matchid = query(collection(db,'matches'),where('userMatch','array-contains',user.uid))
const getid = await getDocs(matchid).then((snapshot)=>snapshot.docs.map((doc)=>doc.data()))
console.log('getid',getid)
},[db])
why not get only user.uid in userMatch object. although where() method filter 'userMatch' object field, why get all object field in matches collection.how can get only userMatch object value. plz help