Query a Firestore collection with a not in filter

Query a Firestore collection with a not in filter

Code sample

Java

CollectionReference citiesRef = db.collection("cities");

Query query = citiesRef.whereNotIn("country", Arrays.asList("USA", "Japan"));

Node.js

const notUsaOrJapan = await citiesRef.where('country', 'not-in', ['USA', 'Japan']).get();

Ruby

cities_ref = firestore.col collection_path
usr_or_japan = cities_ref.where "country", "not_in", ["USA", "Japan"]

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser