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.

replicate to nested destination

See original GitHub issue

Hell @anishkny,

Love this architecture and approach, using it already on my latest project!

Question - is it possible (or hard to add) the ability to target a nested property for replication?

My use-case is a “users” collection that is essentially private, and a “workspaces” collection that has an array of memberIds.

I’d like to use integrify to update a memberInfo object on workspaces, keyed by uid, with just the user’s name and avatar.

So the source is a users collection and target looks something like:

workspaces: [{
   id: "some guid",
   memberIds: ["firebaseUid1","firebaseUid2"], <--- this is currently how users are added/removed to workspaces
   memberInfoCache: {  <--- I'd like to add meta info cache to avoid complicated permissions on accessing /users/
       "firebaseUid1": { <--- the foreign key
           "photoURL": "replicated from users/firebaseUid1/photoURL",
           "name": "replicated from users/firebaseUid1/name"
       },
       ...
    }
}]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
anishknycommented, Aug 9, 2019

This has now landed in master. Feel free to replicate to nested destinations thus:

module.exports.replicateMasterToDetail = integrify({
  rule: 'REPLICATE_ATTRIBUTES',
  source: {
    collection: 'master',
  },
  targets: [
    {
      collection: 'subcollection',
      foreignKey: 'masterId',
      attributeMapping: {
        masterField1: 'detail1Field1',
      },
    },
    isCollectionGroup: true,    // <---- NEWLY ADDED!
  ],
  
1reaction
anishknycommented, Feb 14, 2019

I am going to hold off for now in the hopes that Firestore supports “collection group queries” eventually. That should make implementation easier/elegant. Will leave issue open for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

maintain nested structure when replicating artifacts #12890
Expected behavior and actual behavior: If I have a project with a nested folder structure (e.g. my-project/foo/bar) and I replicate the ...
Read more >
Best way to navigate to a nested destination - Stack Overflow
The app I'm currently working on has many fragments with nested menus and a really messy navigation. I thought Navigation with nested nav ......
Read more >
Understanding Loading and Row Usage for Nested Data ...
Depending on the type of destination you're using, Stitch may deconstruct nested data structures into relational tables.
Read more >
S3::Bucket ReplicationConfiguration - AWS CloudFormation
The following example creates an S3 bucket and grants it permission to write to a replication bucket by using an AWS Identity and...
Read more >
Navigation: Nested graphs and include tag | Android Developers
Nested graphs can help you group a series of destinations within a parent navigation graph. Looking at the navigation graph, the coffeeList and ......
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