title: How to use "$or" operator using documents in mongodb using java
body: <pre><code>Document query = new Document();
              query.put("firstName", "abc");
              query.put("firstName", "xyz");
  </code></pre>
  
  <p>Here,"abc" is overrided by the "xyz".So,in the query I'm getting only one value i.e,xyz.I don't know,why the query getting overrided.can u please help me out...</p>
  
  <p>My code:</p>
  
  <pre><code>MongoClient mongo = new MongoClient("localhost",27017);
          MongoDatabase db = mongo.getDatabase("sample");
          MongoCollection&lt;Document&gt; coll = db.getCollection("users");
  
  
          Document query = new Document();
          query.put("firstName", "abc");
          query.put("firstName", "xyz");
  
          Document docStatus =new Document("$or",query );
          try (MongoCursor&lt;Document&gt; cursor = coll.find(query).iterator()) {
              while (cursor.hasNext()) {
              System.out.println(cursor.next());
              }
          }
  </code></pre>