node mongodb $or

const MongoClient = require('mongodb').MongoClient;

// Connection URL
const url = 'mongodb://localhost:27017';

// Database Name
const dbName = 'your_database_name';

// Create a new MongoClient
const client = new MongoClient(url, { useNewUrlParser: true, useUnifiedTopology: true });

// Use connect method to connect to the Server
client.connect(function (err) {
  if (err) throw err;

  console.log('Connected to the database');

  const db = client.db(dbName);

  // Specify the collection
  const collection = db.collection('your_collection_name');

  // Define the $or query
  const query = {
    $or: [
      { key1: 'value1' },
      { key2: 'value2' }
    ]
  };

  // Perform the query
  collection.find(query).toArray(function (err, result) {
    if (err) throw err;

    // Output the result
    console.log(result);

    // Close the connection
    client.close();
  });
});