Firestore get documents where value not in array?

后端 未结 4 938
無奈伤痛
無奈伤痛 2020-11-28 15:02

Is there a way to get all documents which array field does not contain one or more values, now there is \"array-contains\" but is there something like \"array-not-contains\"

4条回答
  •  南笙
    南笙 (楼主)
    2020-11-28 15:40

    Firestore recently added support for a not-in clause.

    citiesRef.where('country', 'not-in', ['USA', 'Japan']);

    That will get every doc where country exists and has a value other than 'USA', 'Japan', or 'null'.

提交回复
热议问题