title: How to query relations in NoSQL?
body: <p>I have decided to move my database from MySQL to Mongo because majority of the time, my data is not structured. And it allowed me possibilities that was too complex in a traditional SQL.</p>
  
  <p>There is one problem that I am currently facing and how to approach a traditional relational model of SQL in NoSQL. I have read many times that NoSQL is not designed to deal with relations. Do I need to add them as an array to the document with a relation?</p>
  
  <p>Here is one situation that has made me stuck. In SQL I had a separate table for oauth access tokens that has user_id, client_id, access_token, expires as its attributes. It was 1-N relation between a user and an access_token. How would I do that in NoSQL? By adding an array field oauth_tokens? If I do that, how do I search for the token in the array? How do I query</p>
  
  <pre><code>search for a document where the _id is $user_id and there is an element
  with $token in the access_tokens array?
  </code></pre>