I know this might be a duplicate of Firestore: how to perform a query with inequality / not equals but I really did not get an answer I want from that question.
Firestore doesn't accept the inequality operator !=
.
Suppose I want to query tasks that are not mine by uid.
Querying for the tasks I created is easy since I only need to use ==
.
I have the following code.
export default function fetchTasks () {
return async (dispatch) => {
const tasks = await db.collection('tasks')
.where('owner', '>', `/users/${uid}`)
.where('owner', '<', `/users/${uid}`)
.get()
const taskList = []
tasks.forEach((task) => {
taskList.push(task.data())
})
dispatch({
type: 'FETCH_TASKS_FULFILLED',
payload: taskList
})
}
}
I can't seem to get this work. Any suggestions would be greatly appreciated. Thanks!