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.

feat(query): populate document reference or computed child key

See original GitHub issue

What is the feature? My document looks like this

# /version/1/cookList/1
{
"name": "Foo",
 "cook": "/version/1/cook/FJp534F4DegCxOW9y2Os"
}

I want to populate cook whose value is full document path and not just ID. I tried something like this after going though few other issues but it did not work.

const populates = (dataKey, originalData) => {
  if (originalData && originalData['cook'] && !originalData['cookData']) {
    originalData['cookData'] = originalData.cook.split('/')[4];
  }
  return [{child: 'ownerData', root: 'version/1/cook'}]
};

const enhance = compose(
  firestoreConnect([
    { collection: '/version/1/cookList', storeAs: 'cooklist', populates }
  ]),
  connect(({ firestore }) => ({
    cooklist: populate(firestore, 'cooklist', populates)
  }))
);

What version would this apply to? latest

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
CTrescommented, Apr 11, 2019

+1

1reaction
prescottpruecommented, Mar 28, 2020

@devth That is a great idea! Thanks for sharing

Read more comments on GitHub >

github_iconTop Results From Across the Web

NetSuite Applications Suite - Select Reference Types
Adding Items to Web Store Categories · Featuring Items · Customizing Items in Your Site ... Custom Child Record Sublist Creation with SuiteScript....
Read more >
How can we use a computed property in the query key (e.g. ...
The react-query docs describe how to use a compound query key (Array Keys). I want to be able to do something similar with...
Read more >
Chapter 5. Data Access and Change - HSQLDB
A SELECT statement featuring DISTINCT or GROUP BY or FETCH, LIMIT, OFFSET is not updatable. In an updatable query expression, ...
Read more >
pugixml 1.13 manual
Document has one or more child nodes, which correspond to C++ type xml_node. ... Memory for XPath query objects as well as internal...
Read more >
Apache Solr Reference Guide: For Solr 6.6
The main part of the reply is in the result tag, which contains one or more doc tags, each of which contains fields...
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