When working with FQL it's often the case that you'll encounter Ref
s. Ref
s don't have any fields on them though! So how do we access the fields? Get
.
Collections()
Collection("customers")
Ref(Collection("customers"), "244075679454331401")
Get(Ref(Collection("customers"), "244075679454331401"))
Get(Collection("customers"))
Instructor: [00:00] When working with FQL, it's often the case that you'll get a ref to a document that you have to deal with or other data type. For example, if we use the collections function, we get a ref to collections. If we select a specific collection, we get a ref to the collection customers.
[00:16] We can even build a ref to a specific document, using the ref to our customers collection, and the ID of the document. Whether constructing the ref ourselves, as in this case, or getting a set of refs from Paginate, you may be wondering where the fields on your documents are. That's where Get comes in. The Get function will retrieve the value of the ref.
[00:39] Note that now the result is the actual object, including the ref to the document and the data. We can see that this is also true for the specific collection. The object for our collection includes history days, which is the number of days before the history gets deleted. Get is an important tool in your tool set when working in FQL.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!