Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove autopublish for sub-documents #453

Open
raragaodl opened this issue Apr 19, 2024 · 5 comments · May be fixed by #454
Open

Remove autopublish for sub-documents #453

raragaodl opened this issue Apr 19, 2024 · 5 comments · May be fixed by #454

Comments

@raragaodl
Copy link

raragaodl commented Apr 19, 2024

Is your feature request related to a problem? Please describe.

I'm using Tabular with a collection with many fields and a lot of them in subdocuments
Example:

{
  _id: 'aaaaa',
  subDoc1: {
    field1: 'a',
    field2: 'b',
  },
  subDoc2: {
    field3: 'c',
    field4: 'd',
  }
}

So when I want to create a tabular with the field1 and field3, I just put definition of data as 'subDoc1.field1', and 'subDoc2.field3'. This works fine, no issues
The problem is that Tabular publish just use the top level field name to publish the document. Then, all fields are being published to the client.

Describe the solution you'd like
I took a look on the code and see in the file tableInit.js a line that remove the sub-fields name, returning just the main level of the fields. The line is 36 with the code:

fields[cleanFieldName(data)] = 1;

Describe alternatives you've considered
None

Additional context

I did a test to my scenario removing the cleanFieldName call, and all the functions seems as fine.
new code:

fields[data] = 1;

Just to understanding, with this change I could reduce data size on client in 80% in my case, and I don't expose any unnecessary data to client.

Copy link

Thank you for submitting this issue!

We, the Members of Meteor Community Packages take every issue seriously.
Our goal is to provide long-term lifecycles for packages and keep up
with the newest changes in Meteor and the overall NodeJs/JavaScript ecosystem.

However, we contribute to these packages mostly in our free time.
Therefore, we can't guarantee your issues to be solved within certain time.

If you think this issue is trivial to solve, don't hesitate to submit
a pull request, too! We will accompany you in the process with reviews and hints
on how to get development set up.

Please also consider sponsoring the maintainers of the package.
If you don't know who is currently maintaining this package, just leave a comment
and we'll let you know

@lynchem
Copy link
Collaborator

lynchem commented Apr 23, 2024

Hey @raragaodl, that seems like a sensible update. Can you create a PR and I'll try review ?

@jankapunkt
Copy link
Member

I can publish a new version or beta version, if needed

@raragaodl
Copy link
Author

Great guys, I will create a PR.

@ricaragao
Copy link
Member

@lynchem @jankapunkt , PR created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants