Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Sharry Stowell
    @molinto
    Hi guys, it it possible to have Validators.or on two fields:
    if email is present use that, if phone is present use that else fail the insert
    Tim Cooper
    @tjscooper
    Does anyone know how to access arguments passed into Astronomy 2 methods?
    It used to be on a “.data” object, has this changed @jagi ?
    maco144
    @maco144
    how do i set to a Class a variable containing fields/values?
    'createMatch': function(gameSelected, gameDetails){
        var gameRules = new GameRule();
        gameRules.set(gameDetails);
        gameRules.save();
            var gameDetails = ({
              winning: $('#matchTeam').val(),
              achieved: $('#matchAchieved').val(),
              objective: $('#matchObjective').val()
            });
    maco144
    @maco144
    hmm that works now but didnt before... unsure what i changed...
    maco144
    @maco144
    im switching from autoform. Shouldnt this be how I close out a modal that has my form?
            afterInit() {
                $('#generalModal').modal('hide');
            }
    this is what I had to do before
    var matchFormHook = {
        onSuccess: function(insert,result){
            if(result)
                $('#generalModal').modal('hide');
        }
    }
    AutoForm.addHooks('matchDetails', matchFormHook);
    maco144
    @maco144
    how to use jquery on element after insert/update? is there a good example or docs?
    jagi
    @jagi
    You should
    @maco144 you shouldn't mix model layer with the view layer. The best places to pot such code is controller. So it would be done meteor method callback that is saving a document
    Hamatek
    @Hamatek
    @jagi before I open an issue have you tried meteor1.3 beta 4 ? I can't get astronomy to work , I get a build error Error: The "collection" property has to be an instance of the "Mongo.Collection" in the "Game" class
    Hamatek
    @Hamatek
    I open the an issue ~ jagi/meteor-astronomy#268
    peterchoo
    @peterchoo

    hi @jagi

    I've got a quick question regarding calculated fields. I've got a schema, and we are implementing some server-side filtering, sorting and pagination. Because of this, we need to have a lower-case version of certain text fields. What would be your recommended method for this? My current thought is to populate e.g. subject_lc with beforeSave: function(e) { this.subject_lc = this.subject.trim().toLowerCase(); }.

    Is this the best way to go about this? Thanks!

    peterchoo
    @peterchoo
    this.set('subject_lc', this.subject.trim().toLowerCase()); ?
    peterchoo
    @peterchoo
    Additionally, I have some calculated fields (for sorting) which require multiple other fields, what can I do if only one of those fields is present, i.e. I am trying to update() and one field gets changed, what is the best way to retrieve the other information required?
    maco144
    @maco144
    I have Person Class and I want to push Person into this other collection only if they dont exist. what is the right way to check to see if a value already exists in a collection before doing a push into a nested collection? Is this a hook with beforeInsert? it must be something simple but i didnt see a direct answer in the docs
    maco144
    @maco144
    i ended up going with Validators.unique(), works perfectly as far as i can tell
    Rom
    @rdewolff
    What about i18n-db (https://github.com/TAPevents/tap-i18n-db) compatibility?
    peterchoo
    @peterchoo

    @jagi - with my subject and subject_lc example above, I want to implement these in afterSet, with a switch statement on my trigger fields (e.g. subject):

    afterSet: function(event) {
      switch (event.data.fieldName) {
        case 'subject': 
          this.set('subject_lc', event.data.setValue.trim().toLowerCase());
          break;
      }
    }

    When create a new MyModel({subject: ' AAaa '}); and then log out the document before calling .save() on it, I see that the subject is set, but sub ject_lc isnt':

    {
      _modifiers: {
        '$set': {
          subject_lc: 'aaaa'
        }
      },
      _errors: { /* ... */ },
      _id: null,
      subject: ' AAaa ',
      subject_lc: null,
      _isNew: true
    }

    How can I have these fields saved when I first create a new model?

    Jernej Jerin
    @jeryini
    @jagi, just a heads up, your documentation is unfortunately unavailable http://astronomy.jagi.io/
    Frank Pimenta
    @frankapimenta
    how can I combine easy-search and astronomy? easy-search returns Object not astronomy class. any ideias?
    maco144
    @maco144
    what am i doing wrong that a method called inside a template isnt correctly saving to the collection?
    methods: {
        makeWinner() {
            this.winner = true;
        },
    sets winner to try but then doesnt save it... it is Player.winner, which is its own field class array inside of my main collection
    peterchoo
    @peterchoo

    @maco144 I believe you would be better off using this.set('winner', true); and you would also have to call this.save() in your method. that said, I would personally make sure that this is run inside a server-side Meteor method:

    ```
    Meteor.methods({
    setPlayerWinner: function(playerId) {
    // Perform checks on this.userId ? Security for who can set winner etc.
    var player = Player.findOne(

    Whoops.... Here you go.
    Meteor.methods({
      setPlayerWinner: function(playerId) {
      // Perform checks on this.userId ? Security for who can set winner etc.
      var player = Player.findOne(playerId);
      player.set('winner', true);
      player.save();
      return player;
    });
    maco144
    @maco144
    @peterchoo yeah that makes a lot more sense doing everything through a server method. i was so eager to give it a try through the template i didnt really consider how insecure that would be lol. thanks for the advice
    Andrew Hartwig
    @Andrew1431
    Hey anybody around using v2 astronomy?
    peterchoo
    @peterchoo
    @maco144 No worries, I'm very conscious of it haha. I know Meteor has a lot of latency compensation stuff, which can be handy, but I find the whole allow deny stuff to be a bit complex, and difficult to manage, so I tend to go with the option deny all, and use methods.
    Sergio Tapia
    @sergiotapia
    @jagi Can we use a RC version of astronomy 2.0 today? I'm about to start a large open source Meteor app and would love to use 2.0 in it.
    Gaelan
    @Gaelan
    Is Astronomy 2 documented yet?
    Sam Hulick
    @ffxsam
    is there a way to validate something that has the shape of an Astro class but is not actually an Astro object? for instance: valid = Color.Validate({R: -3, G: 0, B: 255})
    instead of having to do: const c = new Color({R: -3, G: 0, B: 255}); valid = c.validate();
    jagi
    @jagi
    @Gaelan no it's not documented yet
    @ffxsam it's not possible right now but I can allow that. It may be handy
    @sergiotapia yes you can but there can be a few little changes in API of behaviors.
    Sam Hulick
    @ffxsam
    @jagi awesome, that would be helpful. I think it makes sense for validators to be static like that. thanks so much for the awesome work. Astronomy is amazing!
    Deadly0
    @Deadly0
    @jagi can you explain how events work? If i define, for example, before Insert event will it trigger on client and on server together? If yes, how to define server side event only?
    Jørgen Foss Eri
    @jorgeer
    Haha, @Deadly0 , came to ask the exact same question
    Though, with the afterInsert event. I want to trigger a function on the server when a document is inserted on the client side.
    Jørgen Foss Eri
    @jorgeer
    For now I've been using matb33:collection-hooks, but it isn't as elegant as having it in the model.
    MyCollection.getCollection().after.insert(function (userId, doc) {....});
    Anton S
    @SPAHI4
    Does astronomy supports validating of nested classes?
    Mike Cardwell
    @mikecentiq
    When using inheritance with a typeField, I thought that by calling Parent.find(), it would also pull out Child items. It doesn't though. Shouldn't it? This is certainly the expected behaviour to me... Could an option be added to allow this?
    Adam Heller
    @HellerCommaA
    Anyone implement easy search with astronomy yet?
    Adam Heller
    @HellerCommaA
    update: works with no issues
    Adam Heller
    @HellerCommaA
    will boolean false values always show?
    my true values are showing ... just not my false values. trying to make sure it's not a framework thing before i go tearing into my code.
    funny. default: true will display 'true' default: false will display ''