I want to sort the data by the "reason" field's values like "spam" , "nudity" and other reasons. could you please help me with that.
CodePudding user response:
For version 8
yourdatabaseRef.where("reason", "==", "fieldNameProvided")
if you then want to order it just add
orderBy("parameter", "desc");
For Version 9
import { query, where, orderBy } from "firebase/firestore";
const q = query(yourdatabaseRef, where("reason", "==", "fieldNameProvided"));
if you then want to order it, make a little change:
const q = query(yourdatabaseRef, where("reason", "==", "fieldNameProvided"), ("parameter", "desc"));
I hope this helps