Code Monkey home page Code Monkey logo

Comments (9)

 avatar commented on May 21, 2024

Is there currently a way to restrict certain fields from being returned from a top-level "find" even if you don't need them to run the child query? Queries such as the following don't seem to work in any context, which makes security management more difficult: db.inventory.find( { type: 'food' }, { item: 1, qty: 1 } )

from meteor-publish-composite.

urossmolnik avatar urossmolnik commented on May 21, 2024

Yes there is. Meteor syntax is db.inventory.find( { type: 'food' }, { fields: { item: 1, qty: 1 } } ).
Documentation

from meteor-publish-composite.

 avatar commented on May 21, 2024

Looks like I need to reread the docs. Thank you.

from meteor-publish-composite.

reywood avatar reywood commented on May 21, 2024

This may be somewhat related to the discussion in #28.

from meteor-publish-composite.

Diggsey avatar Diggsey commented on May 21, 2024

@reywood What are your thoughts on my PR #43 ?

from meteor-publish-composite.

reywood avatar reywood commented on May 21, 2024

It relies on the private function _compileProjection which doesn't seem like a great idea. The Meteor folks could refactor or remove that function at any time. It also completely removes the observeChanges handler which is a major blow to performance in the default use case. Given these issues, I think PR #43 is a non-starter.

from meteor-publish-composite.

Diggsey avatar Diggsey commented on May 21, 2024

It relies on the private function _compileProjection which doesn't seem like a great idea.

True - it would be possible to instead simply duplicate that function here, it's fairly simple.

It also completely removes the observeChanges handler which is a major blow to performance in the default use case.

I don't understand this, if anything removing the call to observeChanges will improve performance. It's better to have one observation running rather than two, and internally observeChanges is implemented in terms of observe anyway.

from meteor-publish-composite.

reywood avatar reywood commented on May 21, 2024

My mistake. I missed that you moved that functionality into the other observe handler. In poking around, it looks like the Meteor folks are moving the diff logic into a separate package called diff-sequence. I was unable to add this package to a new meteor project. Perhaps it's still under development. Probably worth waiting until they've sorted that out, or, as you said, copy this new implementation until they do. I do think this is a good idea.

I'm leaning towards a transform option rather than a fields option. The transform function would be used before sending the doc to the client, but the untransformed doc would be dispatched to child pubs. I think it gives the same functionality but with more flexibility. Your idea to do the diffing in the observe change handler would address the concerns I voiced in #28.

from meteor-publish-composite.

sunstorymvp avatar sunstorymvp commented on May 21, 2024

any news with internal: true?

from meteor-publish-composite.

Related Issues (20)

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.