meteor-astronomy
meteor-astronomy copied to clipboard
Hiding fields isn't working
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?
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.
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.
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;