title: Firestore retrieve data and convert to a struct
body: <p>I am using the code snippet from firestore repository:</p>
  <p><a href="http://firestore%20DataTo%20golang%20returns%20empty" rel="nofollow noreferrer">firestore-golang-snippets</a></p>
  <p>I have a struct for <code>UserFeed</code></p>
  <pre><code>type UserFeed struct {
      date     time.Time `firestore:&quot;date,omitempty&quot;`
      reelUrl  string    `firestore:&quot;reelUrl,omitempty&quot;`
      uid      string    `firestore:&quot;uid,omitempty&quot;`
      username string    `firestore:&quot;username,omitempty&quot;`
  }
  </code></pre>
  <p>I am writing a getFeed function to get user feed like below:</p>
  <pre><code>func GetFeed(ctx context.Context, client *firestore.Client) error {
      // [START fs_get_all_docs]
      fmt.Println(&quot;All feed items:&quot;)
  
      userID := &quot;abcdefghsifkasfkhkfjlkdsaj&quot;
  
      userFeedRef := client.Collection(&quot;feed&quot;).Doc(userID).Collection(&quot;userFeed&quot;)
      iter := userFeedRef.Documents(ctx)
  
      for {
          doc, err := iter.Next()
          if err == iterator.Done {
              break
          }
          if err != nil {
              return err
          }
          var userFeed UserFeed
  
          doc.DataTo(&amp;userFeed)
          // fmt.Println(userFeed)
          fmt.Printf(&quot;Document data: %#v\n&quot;, userFeed)
          fmt.Println(doc.Data())
      }
      // [END fs_get_all_docs]
      return nil
  }
  </code></pre>
  <p>Now when I run this, I get the output :</p>
  <pre><code>Document data: feed.UserFeed{date:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}, reelUrl:&quot;&quot;, uid:&quot;&quot;, username:&quot;&quot;}
  map[date:2020-08-15 07:06:16.183 +0000 UTC reelUrl:https:correctURL.com uid:correctUID username:somethingElse]
  </code></pre>
  <p>My firestore dosuments are stored as /feed/userName/userFeed/documents</p>
  <p>I am not able to understand, why after conversion the data gets converted to 0s and nil.</p>