title: How to use $ne for getting data using mongodb java for document with array.?
body: <p>$ne in momgodb using java not giving proper result. Am i missing something?
  My database is as below.
  <img src="https://i.stack.imgur.com/00Wtl.jpg" alt="enter image description here"></p>
  
  <p>Which contains value where <code>mac_address = "-".</code> </p>
  
  <p>My code for retrieving records where <code>mac_address != "-"</code> is as,</p>
  
  <pre><code>BasicDBObject whereQuery = new BasicDBObject("mac_address", new BasicDBObject("$ne", "-"));
  DBCursor cursor = node_info.find(whereQuery);
  </code></pre>
  
  <p>It's returning all the records. What can be probably wrong.?</p>
  
  <p><strong>Update</strong>
  i converted your suggested query as follow. what's wrong in this?</p>
  
  <pre><code>    BasicDBObject unwind= new BasicDBObject("$unwind","$nodes");
      BasicDBObject mac = new BasicDBObject("mac_address", "$nodes.mac_address");
      BasicDBObject projection= new BasicDBObject("$project",mac);
      BasicDBObject match = new BasicDBObject("$match", new     BasicDBObject("mac_address",notEqual));
     node_info.aggregate(unwind, projection, match);
  </code></pre>
  
  <p>Sorry i am not much familiar with mongodb query.</p>