You have a logic error here.  Make sure you return early after doing a `res.json` and then you can assume state (e.g., you don't have to check on `!count` below, etc.

```javascript
if( err ) {
  ...
  res.send( 500, ... );
  return;
}
if( count ) {
  res.send( 200, ...);
  return;
}

if( badword( sname ) ) {
  res.send( 406, ...);
} else {
  res.send( 404, ...);
}
```