Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Alexis A. Banaag Jr.
    @aabanaag

    hi, have some questions with Class.findOne(). Can I add query inside the findOne() method?

    Class.create({ name: ‘Settings’, fields: { userId: String, name: String } });

    now I want to do is Class.findOne({userId: ‘hello’}); or Class.findOne({ name: ‘Hi’ }); is it possible?

    Andrew Hartwig
    @Andrew1431
    Yes, but you also need a { collection: new Mongo.Collection('settings') } key in there.
    PolGuixe
    @PolGuixe
    which version of regex does it support?
    I am trying to find a suitable regex expression for URLs
    Romuald DANSOU
    @inromualdo
    Hi
    What about transaction with astronomy?
    Romuald DANSOU
    @inromualdo
    What about publish-composite? I am new with astronomy.
    Adalberto Soares
    @soaresa
    You can use publishComposite with astronomy but you must use collections in it and not the classes
    midisale
    @midisale
    I can't even get the examples running...
    on Class.create({...}) I get (STDERR) TypeError: Super expression must either be
    null or a function, not object
    any suggestions?
    using Meteor 1.4.2.3
    blob
    blob
    midisale
    @midisale
    blob
    midisale
    @midisale
    Figured it out. I was mistakenly putting "new" before Class.create
    Romuald DANSOU
    @inromualdo
    Thank you. Can i use babrahams:transactions with astronomy? If not how can i do transactions?
    Zak Lampert
    @zaklampert
    Is it possible to publish _removed documents explicitly?
    Lucas Peres
    @mysyfy
    how can i define my own cast method for each field ?
    need to parse date coming from input
    akumei
    @akumei
    Hi Have a super random question... do you know if Astronomy's save field modifier accepts anything besides an array?
    I currently am testing with it and we noticed that it says array of fields but can it just accept one single string that's not in an array? Thanks! :)
    Punita Ojha
    @punitaojha
    This message was deleted
    Srimal Priyanga
    @SrimalPriyanga
    documentation not clear especially "Fetching documents" section :worried:
    davidsavoie1
    @davidsavoie1
    In the Transient fields section, the age field is calculated and initialized in the afterInit event. In that case, will age change as time goes on, or is it calculated only once and then it's set? Why should we use Transient fields instead of Helpers in this case?
    pit999
    @pit999
    Is there an example for integration with Ionic and typescript?
    pit999
    @pit999
    How can I use MongoObservable (import { MongoObservable } from 'meteor-rxjs';)
    Alex Price
    @remotealex
    Is there a nice way to prevent the updating of a field entirely? I'm extending the Meteor.users collection and want to safeguard against updating emails and passwords though the Astro class
    Alex Price
    @remotealex
    Ah! there is an immutable flag <3
    J3m5
    @J3m5
    Hi! I don't understand how to use Validators. I would like to use it to validate a method in the server side extended method, but I don't know where to put the validate method. In the class? Server-side? Client side?
    J3m5
    @J3m5
    And does the validate method replace the save method? I'm a bit confused, the doc doesn't seem clear to me.
    Andreas
    @andreyunugro
    Hi @J3m5, here the documentation link to create custom validators: https://jagi.github.io/meteor-astronomy/#creating-validators
    I recently defined it in the same file js as schema definition
    So it is server side, you can define it in the same file as schema definition, and after you defined it, you can use it in the fields definition
    AFAIK, Validate method add validation when you call .save();
    J3m5
    @J3m5
    Thank you for your answer. I have succeeded to use it. For now, I don't use custom validators. I use the validate method in the server side class and i do the save() in the else of the "if(ValidationError.is(err)) {}". It works pretty well like that. It gives me this:
     this.validate({
                    fields: ['name']
                }, (err) => {
    
                    if (ValidationError.is(err)) {
                        throw new Meteor.Error();
                    } else {
                        return this.save();
    }
    Andrew Ckor
    @andrewckor
    Hello guys!
    I'm using Astronomy for a long time, it used to work perfectly. But when I updated to meteor 1.6 I keep getting errors on save();
    Exception while invoking method '/Astronomy/execute' TypeError: Class is not a constructor
    I20171103-20:10:21.932(2)?     at DDPCommon.MethodInvocation.astronomyExecute (packages/jagi:astronomy/lib/modules/methods/meteor_methods/astronomyExecute.js:22:11)
    I20171103-20:10:21.933(2)?     at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1768:12)
    I20171103-20:10:21.933(2)?     at DDP._CurrentMethodInvocation.withValue (packages/ddp-server/livedata_server.js:719:19)
    I20171103-20:10:21.933(2)?     at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1134:15)
    I20171103-20:10:21.934(2)?     at DDPServer._CurrentWriteFence.withValue (packages/ddp-server/livedata_server.js:717:46)
    I20171103-20:10:21.934(2)?     at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1134:15)
    I20171103-20:10:21.934(2)?     at Promise (packages/ddp-server/livedata_server.js:715:46)
    I20171103-20:10:21.934(2)?     at new Promise (<anonymous>)
    I20171103-20:10:21.934(2)?     at Session.method (packages/ddp-server/livedata_server.js:689:23)
    I20171103-20:10:21.934(2)?     at packages/ddp-server/livedata_server.js:559:43
    I see more people getting this in older issues, but not anymore, and I don't know if it's my problem or meteor.
    Andrew Ckor
    @andrewckor
    I fixed it guys!!
    Not sure though why all this time used to work :/
    I imported my classes into server and it worked.
    import '../imports/api/classes/Customer';
    import '../imports/api/classes/Brand';
    Alex Price
    @remotealex
    Is there a definitive way to do an auto-incrementing field in astronomy? I've read the main issue on it and noticed it was on the list for the 2.0 road map but never got checked off!
    I'm going to try and use this https://github.com/usefulio/meteor-mongo-counter/ :)
    Alex Price
    @remotealex
    That package seems well out of date. Going to roll with mongodb-counter
    Andreas
    @andreyunugro
    I think you can use and define event beforeInsert, increment the value in that event.
    // In your schema definition, add event beforeInsert:
    events: {
        beforeInsert(e) {
          const latest = XXX.findOne({}, {
            sort: { YYY: -1 },
          });
          e.currentTarget.YYY = (typeof latest === 'undefined') ? 1 : latest.YYY + 1;
        },
      },
    Just add to your alternative way to do it.. :)