question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

get item by the label of a linked entry

See original GitHub issue

I figured out how it is possible to get entries by a linked entry (lets say a one-to-many Category) and thats great.

        let options = {
          'content_type': 'study',
          'limit': params[0],
          'skip': params[1],
          'order': params[2],
          'fields.category.sys.id': params[3],
          'fields.author.sys.id': params[4]
        };

but is it possible to use, lets say fields.category.fields.label or even better fields.category.fields.slug, instead of its id (here: fields.category.sys.id) ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
Khaledgarbayacommented, Mar 6, 2017

@groundc @stickyhands this is now possible , Here is an example code to do that. Please note that you need to specify the contentType of the reference field that you will querying. which is what am doing in fields.bestFriend.sys.contentType.sys.id.

var contentful = require("contentful")

var client = contentful.createClient({space:"cfexampleapi", accessToken:"b4c0n73n7fu1"})

var entries = await client.getEntries({content_type: "cat",
"fields.bestFriend.fields.color": "gray",
"fields.bestFriend.sys.contentType.sys.id":"cat"})
2reactions
ghostcommented, Mar 6, 2017

Thanks a lot for your reply! Works great.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Find html label associated with a given input
Here is a function that takes the element as an argument and returns the associated ... This code supports getting the labels of...
Read more >
The Label element - HTML: HyperText Markup Language | MDN
The HTML element represents a caption for an item in a user interface.
Read more >
HTML Inputs and Labels: A Love Story | CSS-Tricks
There are two ways to pair a label and an input. One is by wrapping the input in a label (implicit), and the...
Read more >
Using label elements to associate text labels with form controls
The objective of this technique is to use the label element to explicitly associate a form control with a label. A label is...
Read more >
HTML label tag - W3Schools
Tip: The for attribute of <label> must be equal to the id attribute of the related element to bind them together. A label...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found