2

I'm trying to write a query where I can get only the posts that have the same categories from Firestore based on categorieId, but am unable to get it to work. What am I missing here?

when I remove where: ["categorieId", "==", idCateg], i get all the posts data without error, but me i want posts by categories

const mapStateToProps = state => {
  return {
    posts: state.firestore.ordered.posts,
    auth: state.firebase.auth,
    profile: state.firebase.profile
  };
};

export default compose(
  connect(mapStateToProps),
  firestoreConnect((props) => {
    const idCateg = props.match.params.id;
    // console.log(idCateg);
    return [
      {
        collection: "posts",
        where: ["categorieId", "==", idCateg],
        orderBy: ["createdAt", "desc"]
      }
    ];
  })
)(CreatePost);

the value of the posts returns undefined while I followed the redux firestore method where. need help

Micessien
  • 431
  • 1
  • 4
  • 7

0 Answers0