<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Graphql on BradCypert.com</title>
    <link>https://www.bradcypert.com/tags/graphql/</link>
    <description>Recent content in Graphql on BradCypert.com</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 27 Dec 2022 16:51:00 -0500</lastBuildDate>
    <atom:link href="https://www.bradcypert.com/tags/graphql/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Using Mongo&#39;s ObjectIDs with Go-Graphql</title>
      <link>https://www.bradcypert.com/using-mongos-objectids-with-go-graphql/</link>
      <pubDate>Sun, 20 Oct 2019 00:00:00 +0000</pubDate>
      <guid>https://www.bradcypert.com/using-mongos-objectids-with-go-graphql/</guid>
      <description>&lt;p&gt;I’ve been working on building a Graphql API in Go and recently ran into an issue serializing Mongo’s ObjectIDs. This doesn’t sound like a difficult task, and thankfully it’s not, but it wasn’t super obvious how to go about this.&lt;/p&gt;&#xA;&lt;p&gt;First, we need to identify what an object ID really is. In the official Mongo driver, we can see that there is a type representation for ObjectID. Additionally, there are methods to convert an ObjectID to a hex value and vice-versa. This means that we could maintain two structs for our models, one with the hex value for an ID and the other with the ObjectID (for encoding/decoding directly to mongo). However, this means that we’d also have to maintain two different models and translate between the two manually.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
