Code Monkey home page Code Monkey logo

meteor-denormalized-views's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

meteor-denormalized-views's Issues

refreshManually does not insert docs in view if they don't exist yet

because of this issue #4

i need to manually refresh docs if the source collection has changed. However if the doc does not exist in the target view collection, it does not get inserted, because it asumes that the doc is already there.

Solution would be to do an upsert there instead of an update.

Struggling to get basic implementation working...

This package looks like a god-send... but I'm a bit confused as to what I'm doing wrong. Hoping you might be able to point me in the right direction and clarify a couple of issues.

So, the end goal is to get tabular search working across multiple collections. We have a Responses collection, referencing both a contact and survey collection.

At the moment, my view looks like this...

 DenormalizedViews.addView({
        identifier: ident,
        sourceCollection: Responses,
        viewCollection: ResponsesView,
        pick: ['created', 'comment', 'score', 'contact', 'survey'],
        sync: {
            contactCache: (response) => {
                return Contacts.findOne({_id: response.contact});
            },
            surveyCache: (response) => {
                return Surveys.findOne({_id: response.survey});
            }
        },
        postSync: {
            responseContact: (response) => {
                const contact = response.contactCache.email;
                return contact;
            },
            responseSurvey: (response) => {
                const survey = response.surveyCache.name;
                return survey;
            }
        }
    });

I've also set up two refreshByCollections. Think I'm missing something, but just can't get anything beyond an empty cursor. To be frank, I haven't dug around too much in the code, so I'm probably just missing something really basic and hoping for a magic bullet. Two things I wasn't exactly sure about were the role of the identifier and the params on refreshByCollection, for example (doc, docPrevious, userId). Any pointers would be greatly appreciated! Thanks.

use observe directly instead of collection-hooks

collection-hooks do not work in all occasions, e.g. if a collection is changed from another instance.

using cursor.observe should be more stable then collection-hooks. This also works if the source collection was changed in the mongodb directly

CQRS/Event sourcing

Hi @thebarty,

I find this package interesting, and as I see that you are actively working on it, I wonder if you are familiar with the Event sourcing architecture and with CQRS? The idea to have distinctions collections for writing and reading and a unidirectional data flow in between matches perfectly theses architecture principles, though the concepts naming is a little bit different—for example a “denormalized view” would be a “materialized view”.

So I just wanted to open a discussion on that, maybe these architectures could help to write the documentation or even to shape work in progress APIs.

Using a dynamic filter?

Hoping this package isn't entirely abandoned, as it seems to be the key to fixing our broken Tabular tables that don't search or column-sort across collection joins.

How do you pass a filter at runtime using this package? As we would want the filter to run based on the user and their application context (e.g. showing a table of a user's posts from a specific chat room using a chatroomId, etc.) We would need that to run dynamically for all our users across all their chatrooms. In other words, a user goes into a chat room, goes to a tab that has a tabular table on it, and the table lists their posts from that chatroom.

We don't want or need to have the denormalized view run on every single chat post in the entire collection. Only on those that match the filter.

The knee-jerk solution seems to call a method that calls (and defines) addView at runtime upon visiting the table's template. But then how do we wait for it? How do we destroy it? Would this leak/build up memory on the server?

Having the same issue with the denormalize package which seems to run by default on the entire collection. Not a subset defined by a query.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.