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

Hiding fields isn't working #650

Open
dnish opened this issue Jan 18, 2018 · 3 comments
Open

Hiding fields isn't working #650

dnish opened this issue Jan 18, 2018 · 3 comments

Comments

@dnish
Copy link

dnish commented Jan 18, 2018

Hey,
I'm returning this array in one of my Meteor methods:

return Video.find({status:'released'},{limit:500,fields:{md5:0}}).fetch();

The problem is that the md5 field is also part of each document, so the fields parameter doesn't seem to work on Astronomy? Is this the normal behavior or did I something wrong?

@lukejagodzinski
Copy link
Member

Using the fields option will not fetch these fields from the collection but it astronomy documents field will still be present however its value will be undefined. It was required to make documents consistent with a schema. Maybe it was a wrong design decision but I can't do anything it now as it would be compatibility breaking change.

@dnish
Copy link
Author

dnish commented Jan 18, 2018

Hey,
no, in my case the value is still available and not undefined. I've also the problem that when I query via the Mongo collection (without Astronomy):

const Videos = new Meteor.Collection('videos');
const videos = Videos.find({}).fetch();

videos[0] instanceof Video // true

Video is the Astronomy class, but if I remember it right, I should get normal MongoDB document if I use Videos because Astronomy wouldn't manipulate the "original" MongoDB object.

@lukejagodzinski
Copy link
Member

If you have the default value set for that field that it will be populated. To turn off this behavior you have to configure Astronomy somewhere at the top of the dependencies tree. The best would be the main.js file or similar.

import { Astro } from 'meteor/jagi:astronomy';
Astro.config.defaults = false;

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

No branches or pull requests

2 participants