Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    jayspirits
    @jayspirits
    my astronomy is not updating to 2.0, any thoughts?
    jagi
    @jagi
    @jhuenges you have to create custom validator http://jagi.github.io/meteor-astronomy/v2#creating-validators
    However, maybe I will introduce a validator called "custom" which as a param takes a function which has to return true/false
    @jayspirits what do you mean by saying "is not updating". Are you getting some error?
    dw72
    @dw72

    @jagi there is mistake in docs...
    "NOTICE: In the first line, we call the find() method from the User class and in the second line from the Users collection. The slug behavior uses the beforeFind event to modify selector that will cause fetching only non-removed documents."

    There is 'slug' but it should be 'softremove' behavior

    jhuenges
    @jhuenges
    @jagi is there out of the box integration for validated-method or do I have to write my own validation function?
    mytc
    @mytc
    @jagi , in version 1 I can use set() to update a document with a object. eg: space.set({title:'blah blah', content:'blah blah', category: 'blah blah'}); But in version 2, the set()is deprecated. Is there any way to set the document with an object?
    Max Matthews
    @maxmatthews
    @mytc I would think you can just do space = {title:'blah blah', content:'blah blah', category: 'blah blah'} Could be wrong about that though. Haven't pulled the trigger to v2 yet because I need the relations module
    mytc
    @mytc
    @maxmatthews , but when I try to saving the data using save() method, I got this ' has no method \'save\'\n ' in the terminal..I saving it in server side only though
    Max Matthews
    @maxmatthews
    @mytc How about space = new Space({title:'blah blah', content:'blah blah', category: 'blah blah'})
    The problem with that is it's going to overwrite fields, not update the ones you provided. Not sure if that's an issue for you
    Max Matthews
    @maxmatthews
    @mytc Where did you see that set is depreciated? According to this section of the documentation it's still valid: http://jagi.github.io/meteor-astronomy/v2#setting-and-getting-values
    @jagi Any updates on relations support for v2? Happy to lend a hand if you want some help.
    mytc
    @mytc
    @maxmatthews , I tried with set(), but then i get this 'has no method `set\'\'n' again. I think maybe the problem is on the method been called in server side. I sorely saving the object on method call, I don't know if this is the issue. However, no problem on creating new document though.
    Max Matthews
    @maxmatthews
    @mytc Can you post some code or a gist?
    mytc
    @mytc
    Note that the EditSpace in the meteor method
    Max Matthews
    @maxmatthews
    So I'm guessing is Spaces is a Mongo.Collection? I think you should be using Space as that's the astronomy class.
    ragulka
    @ragulka
    has anybody had success in defining a User class using the Meteor.users collection?
    I'm having trouble with it - whenever I do User.findOne() in client, I get undefined as the result
    Tsegaselassie Tadesse
    @tsega
    @ragulka, how have you defined your User astronomy class here is how I do it:
    User = Astro.Class({
        name: 'User',
        collection: Meteor.users,
        fields: {
            ...
        },
        validators: {
            ...
        },
        methods: {
            ...
    });
    Then, of course, you need to publish Meteor.users from the server and subscribe to it on the client. There is no need to define a new Users collection! You can work with the Meteor.users one it will be giving you the newly defined User Astro class.
    mytc
    @mytc

    @maxmatthews , you were right, it is my mistake. Changing to astronomy class works. However, I still got this exception in the console.

    Exception while invoking method 'EditSpace' { stack: 'TypeError: Cannot read property \'upsert\' of undefined\n at MongoConnection.mongoConnectionProto.(anonymous function) [as update] (packages/meteorhackskadira/lib/hijack/db.js:73:1)\n at OptimizedApply (packages/meteorhacks_kadira/lib/utils.js:31:1)\n at Object.ret.(anonymous function) [as update] (packages/meteorhacks_kadira/lib/hijack/db.js:20:1)\n at documentUpdate (packages/jagi:astronomy/lib/modules/storage/utils/document_update.js:75:41)\n at Class.save (packages/jagi:astronomy/lib/modules/storage/class_prototype_methods/save.js:106:50)\n at [object Object].EditSpace (apps/booking/server/actions.js:49:12)\n at [object Object].methodMap.(anonymous function) (packages/meteorhacks_kadira/lib/hijack/wrap_session.js:164:1)\n at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1704:12)\n at packages/ddp-server/livedata_server.js:711:19\n at [object Object]..extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)',

    mytc
    @mytc
    But the document properly updated though
    Max Matthews
    @maxmatthews
    Hmm, got no ideas on that one
    mytc
    @mytc
    @maxmatthews , hmm...i can't find anything on google either.. anyway thanks for you helps. Hope that @jagi can help me with this.
    jhuenges
    @jhuenges

    @jagi how would you handle errors during .save()? For example: I need to save relationships between documents of the same class. And these relationships need to be stored on both documents. So if i do somehting like

    doc1.relationships = [doc2._id];
    doc1.save();
    
    doc2.relationships = [doc1._id];
    doc2.save();

    and now something doesn't work while saving doc2, what is the easiest/best way to undo the changes?

    Sam Hulick
    @ffxsam

    question about this in the V2 docs:

    The this context in event handler is not a document. Use event.target to get a document. Use event.currentTarget to get nested document.

    does that mean if I have a Comment model that only exists as a nested object, used on Post, for example.. the event hooks in Comment have to use event.currentTarget?
    and if so, i assume event.target would refer to the parent, Post?
    Mirza Joldic
    @purplecones
    This message was deleted
    Aharon Rossano
    @aharonrossano

    Found a small issue in the documentation:
    const Visibility = Enum.create({
    name: 'Visibility',
    options: {
    PUBLIC: 0,
    PRIVATE: 1,
    INVITE_ONLY: 2
    }
    });

    'options' should be 'identifiers'

    I'm having trouble after creating my object to get the _id.
    I console.log the object and get everything except for _id.
    e.g:
    conversation = new Conversation(conv);
    console.log(conversation);
    {_id: undefined..
    Jimmy Knoot
    @jimmy1993k

    nice documented, some small things I saw while reading over it were
    var child = new Child();
    child.type; // "Child"

    var parent = new Parent();
    child.type; // "Parent"

    it should be parent.type I guess.

    birthDate: {
    type: Date,
    validators: [{
    type: 'lte',
    resolveParam: function() {
    let date = new Date();
    return date.setFullYear(date.getFullYear() - 18);
    }
    }]
    },

    I know it's just an example but you might put people on the wrong path with this one, because you're not taking into account the month and days of the year

    Joe
    @joetidee
    hi
    Anton S
    @SPAHI4
    Is this good idea to use transient field as relation? Or what is the best way?
        events: {
            afterInit: function() {
               this.user = User.findOne(this.userId);
            }
        }
    Anton S
    @SPAHI4
    and how to use DDPRateLimiter package with Astronomy methods?
    Namir
    @namirsab
    Hello!
    I have a question. Is possible to use the Schema system from astronomy independently?
    PolGuixe
    @PolGuixe
    Does anybody know how to simulate a high latency enviroment with Astronomy?
    I want to test how latency compensation works with Astronomy
    Without using Astronomy I used to put a Meteor._sleepForMs(10000); in the Meteor method, before doing the insert or the update
    peterchoo
    @peterchoo
    Hi all, I'm wondering if it's possible to have nested arrays defined and validated in Astronomy, either v1 or v2. My use case is we have a set of rules which need evaluating. These rules may have multiple conditions. We are using two arrays as an "or" array, which contains "and" arrays:
    
    
    Whoops:
    {
      rule: [
        [
        ]
      ]
    }
    so any objects in the inner array will be considered with an and condition, and if there are more than one inner array they will be considered as or conditions

    the conditions will be a separate astronomy class with some specific validation, for now lets assume a class name of RuleCondition. I can define with:

    {
      rule: {
        type: 'array',
        nested: 'RuleCondition'
      }
    }

    But this is only with one surrounding array. I'd like to be able to have two nested arrays. Any ideas?

    peterchoo
    @peterchoo
    @jagi Is this possible in Astronomy v1 or v2? Could this be possible with a custom type?
    jongidal
    @jongidal
    Is there any way to use es2015 Class with astronomy?
    PolGuixe
    @PolGuixe
    This message was deleted

    @jagi in case I do:

    doc._id = docId; //Generated using Random.id()
    doc.save();

    But that docId already exists in the DB...Will Astronomy try to generate a new _id and insert the document?

    Lucas Peres
    @mysyfy
    How can I use ENUM type at Blaze Templates ?
    For ex: export const Depts = Enum.create({
    name : 'Depts',
    identifiers : ['DeptHR','DeptAccouting', 'DeptFinances']
    });