SINGLE account relation streams with context (in metadata) behavior

Hey there!

Was curious to know what would be the expected behavior for streams being a single account relation (like a profile) when a different context is being used in the metadata?

I tried it and it seems like this is creating a unique stream per context instead of updating the existing one when using a different context in the metadata, is this the expected behavior @spencer?


1 Like

Hmm… yeah that’s definitely expected based on how the code is written, though TBH I don’t think we put too much thought into how context would interact with deterministic document creation when we added it in for you.

Does this behavior work for your needs? Or do you need it to work differently?

Thanks for the answer! I would have expected the “SINGLE” account relation to be the same across the entire network and different contexts. That would be useful for user profiles for example while still allowing contextualized queries on our side.

For now we will probably end up not using contexts for those kind of streams (user profiles) but that will make our work on shared instances a bit harder.

Ideally we could have another relation that would be something like “SINGLE_PER_CONTEXT” but that’s not urgent at all.

I would have expected the “SINGLE” account relation to be the same across the entire network and different contexts.

I’m not really sure I understand what you are imagining the behavior here would be? Each stream can only have a single metadata object, so each stream can only have a single context. So either you need a different SINGLE stream instance for each context (which seems to be how it works today), or you have only one SINGLE stream instance, but then it can only have one context (or maybe the context should be left empty?).

To be honest, the fact that each stream can only have a single context is part of why I’m not really convinced that context (at least as we have it working today) is actually the right abstraction for what you’re trying to do. There’s definitely value in letting applications define groups of related streams across models, but it seems like ideally any given stream could show up in multiple of these groupings rather than being tied to just one.

Yeah I think this is the right way to do this, we will be leaving the context empty for those global streams like the user profile, thanks!