Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
358 views
in Technique[技术] by (71.8m points)

javascript - Firestore select where is not null

I'm using firebase to manage my project and I cannot get to create a query with a where clause where some value is not null.

Example: I have a collection of employees. Each have a list of equipments as an object where the key is the equipment id and the value a color.

user = {
    firstName: 'blabla',
    lastName: 'bloblo',
    equipments: {
        123: 'blue',
        124: 'red'
    }
}

I would like to get all the employees who has a certain equipment in the equipments. Lets say 123.

It comes to Select * from Employees where equipments.123 is not null. I've tried:

firestore.collection('employees').where(`equipments.${equipmentId}`, '!=', null)

but it's not working.

I can't seems to make it work. Can you help me.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...