title: How to return an object instead of an array? (mysql with node,js)
body: <p>Hey so quick and short I just started using mysql today and I grasped creating a table, inserting rows in that table, querying rows, updating and deleting etc.. But I cant figure out how to return an object if im returning a single object. </p>
  
  <p>for example:</p>
  
  <p>I want to return an object like this</p>
  
  <p>{title: 'object1', body: 'this is object number 1'}</p>
  
  <p>instead it returns </p>
  
  <p>[{ title: 'object1', body: 'this is object number 1 }]</p>
  
  <p>I am usedto using mongodb with mongoose and when I used </p>
  
  <p>collection.findOne I got an object if I used collection.find I got an array</p>
  
  <p>So must I always return an array instead of object with mysql? I have heard of WITHOUT_ARRAY_WRAPPER I tried using it like this </p>
  
  <pre><code> let query = `SELECT * FROM posts WHERE id=1, WITHOUT_ARRAY_WRAPPER`;
  
   connection.query(query, (err, results, feilds) =&gt; {
       if(err) throw err;
       //etc...
   });
  </code></pre>
  
  <p>But I get a syntax error stating "ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WITHOUT_ARRAY_WRAPPER' at line 1"</p>
  
  <p>If anyone can help shine some light on this would be greatly appreciated.</p>