Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Manjukb
    @Manjukb
    how can i do this
    This message was deleted
    This message was deleted
    {code}
    var createContactAstroClass = function createContactAstroClass(name, defaultType) {
    return Astro.Class({
    name: name,
    fields: {
    type: {
    type: "string",
    default: defaultType || "personal"
    },
    value: {
    type: "string",
    }
    }
    });
    };
    Luis Herranz
    @luisherranz

    If I use this:

    var app = new App();
    Template.XXX.helpers({
      app() { return app; }
    });

    and later on I change app with set()... then validate() and then save()... things in the template are not-reactive:

    This won't update {{app.url}} if coming from that helper, even if it's saved in Minimongo via save().

    If I want it to be reactive, I have to change the helper to something like:

    Template.XXX.helpers({
      app() { return Apps.findOne(_id); }
    });

    with the _id of the previously saved app object.

    Do you have plans to make a new Astro object reactive by itself without having to change it for a Minimongo query after saving?

    Dave
    @macasas
    Hi everyone, trying to get my head around astronomy and replace my verbose UserProfile code. Pasted in the example User = Astro.Class({
    name: 'User',
    collection: Meteor.users, ......... and it is telling me Error: The "collection" property has to be an instance of the "Mongo.Collection" in the "User" Does anyone have any info on this, perhaps a work-around? Thanks
    Sorry, getting confused.... I think this is related to the accounts package not being installed in the astro example. As you were :-)
    Sam Hatoum
    @samhatoum
    See herE:
    @macasas
    Dave
    @macasas
    @samhatoum Thanks for your reply, this is the repo that first informed me about astronomy. I have seen this example in a number of places now, all similar in form but while I can use astronomy for other collections I have so far been unsuccessful in replacing my sign up process to create a suitable Meteor user. I am using Meteor.createUser with options filled from a form to trigger Accounts.onCreateUser which is sending verification emails. When I add the nested UserProfile class it gets saved in mongo as EJSON classes. I know I'm doing something wrong, need to play more with astronomy because everyone is saying the same thing about how to do it, but it just isn't working for me. I will return to this repo and read more. Thanks.
    negamaxi
    @negamaxi
    Hi there guys, this package is awesome!! Can someone explain Astro schemas validate field types by default or I need to manualy attach validators to each field? Thanks!
    Jernej Jerin
    @jeryini
    hi!
    I am looking at documentation for Custom Types
    and examples of array_field.js and object_field.js
    but still have hard time building a custom type set
    I want to have a support for Set object
    I tried to use the code from array_field, but with not much sucess. Acctually it did store something in the document for that field, but it looks broken :)
    also @jagi thank you very much for this super great package
    Jernej Jerin
    @jeryini
    I have created a separate help topic on official Meteor forums if someone is willing to help https://forums.meteor.com/t/implementing-custom-type-in-astronomy/16266?u=jeryslo
    Tim Cooper
    @tjscooper
    Moving to Astronomy 2... Doing type checks I uncovered (not confirmed entirely) a difference between fields set with and without default.
    i.e.
    orderId: String validates as String
    orderId: { type: String, default: 'test' } validates only as 'string'
    Tim Cooper
    @tjscooper
    @jagi Have I uncovered a type conversion issue there?
    Tbutnyakov
    @Tbutnyakov
    Hey!
    What about relations? Is it work in this version? Example from docs didn't work:(
    Darko Mijić
    @darko-mijic
    Hi @jagi. I havent been here for a wihile. Can you drop me a quick note in what phase is Astronomy 2, is it currently usable and what do you have in mind for a release date. I will start using it in new client project that is starting tomorrow, so I need your pointers regarding should I try v2 for this project. Do You need help with work on a v2 branch of meteor-astronomy-examples?
    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