title: How to get an ID from Ref in fauna?
body: <p>I'm fetching documents from faunadb and I would like their ID to be in the payload that I send to the client.</p>
  
  <p>This is how I fetch the documents and return their data as a collection</p>
  
  <pre class="lang-js prettyprint-override"><code>
  serverClient.query(
    q.Map(
      q.Paginate(q.Documents(q.Collection('Portfolio')), { size: 999999 }),
        q.Lambda(x =&gt; q.Get(x))
      )
    )
    .then((ret) =&gt; ret.data.map(x =&gt; ({ ...x.data, _id: x.ref })))
  </code></pre>
  
  <p>Now <code>_id</code> is a Ref. Looking like this when I log it to the console:</p>
  
  <pre><code>Ref(Collection("Portfolio"), "266565241615155713")
  </code></pre>
  
  <p>And like this when JSON Stringifying it:</p>
  
  <pre><code>{"@ref":{"id":"266565241615155713","collection":{"@ref":{"id":"Portfolio","collection":{"@ref":{"id":"collections"}}}}}}
  </code></pre>
  
  <p>I basically need to get the ID <code>266565241615155713</code> from that Ref. How can I do that?
  I tried <code>x.ref['@ref'].id</code> but <code>@ref</code> is undefined.
  <a href="https://docs.fauna.com/fauna/current/api/fql/functions/ref" rel="noreferrer">The documentation</a> did not help me here</p>
  
  <p>Thanks in advance for any hints.</p>