mongodb query for null code example
Example 1: mongodb exists and not null
db.collection1.find({ 'fieldname1' : { $exists: true, $ne: null } });
Example 2: mongo db returning null in array of string graphql
// Using the same query as aboveconst result = await client.query({ query: query });if (result.data.restaurants) { result.data.restaurants.forEach(restaurant => { if (restaurant) { console.log(restaurant.name); console.log(restaurant.location.address); } });}