meteor-tabular icon indicating copy to clipboard operation
meteor-tabular copied to clipboard

Remove autopublish for sub-documents

Open raragaodl opened this issue 10 months ago • 5 comments

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.

raragaodl avatar Apr 19 '24 21:04 raragaodl

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

github-actions[bot] avatar Apr 19 '24 21:04 github-actions[bot]

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

lynchem avatar Apr 23 '24 11:04 lynchem

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

jankapunkt avatar Apr 23 '24 12:04 jankapunkt

Great guys, I will create a PR.

raragaodl avatar Apr 23 '24 12:04 raragaodl

@lynchem @jankapunkt , PR created.

ricaragao avatar May 18 '24 16:05 ricaragao