title: Querying Mongodb Subdocuments error Converting circular structure to JSON
body: <p>I have a document with an array of subdocuments:</p>
  
  <pre><code>{
    "company": "test plc",
    "address": [
      {
        "addr1": "37",
        "addr2": "",
        "addr3": "test",
        "addr4": "",
        "addrcity": "",
        "addrcounty": "test",
        "addrpostcode": "test"
      },
      {
        "addr1": "37",
        "addr2": "",
        "addr3": "test",
        "addr4": "",
        "addrcity": "",
        "addrcounty": "test",
        "addrpostcode": "test"
      },
      {
        "addr1": "37",
        "addr2": "",
        "addr3": "test",
        "addr4": "",
        "addrcity": "",
        "addrcounty": "test",
        "addrpostcode": "test"
      }
    ],
    "contacts": [
      {
        "name": "test",
        "surname": "testing",
        "title": "master"
      },
      {
        "name": "test",
        "surname": "testing",
        "title": "master"
      }
    ]
  }
  </code></pre>
  
  <p>What I would like to do is return a list of documents by searching the <code>contacts.surname</code> property.</p>
  
  <pre><code>var leads = Lead.find({"contact.surname":req.params.name});
  </code></pre>
  
  <p>This causes an error "Converting circular structure to JSON" but I am not sure why.</p>
  
  <p><strong>added on edit:</strong></p>
  
  <p>This is my collection schema:</p>
  
  <pre><code>var leadsSchema = new Schema({
    company: String,
    address:
    [
      {
        addr1: String,
        addr2: String,
        addr3: String,
        addr4: String,
        addrcity: String,
        addrcounty: String,
        addrpostcode: String
      }
    ],
    contacts:
    [
      {
        name: String,
        surname: String,
        title: String
      }
    ]
  });
  var Lead = mongoose.model('leads', leadsSchema);
  </code></pre>
  
  <p>Here are my two routers:</p>
  
  <p>This returns all from the collection find:</p>
  
  <pre><code>router.get('/', function(req, res) {
    Lead.find({}).exec(function(err, leads) {
      res.send(leads);
    });
  });
  </code></pre>
  
  <p>This causes the circular error:</p>
  
  <pre><code>router.get('/findByContactName/:surname', function(req, res) {
    var leads = Lead.find({"contacts.surname":req.params.name});
    res.send(leads);
  });
  </code></pre>