Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Sam Hulick
    @ffxsam
    even this example doesn't work: http://jagi.github.io/meteor-astronomy/v1#pull
    Sam Hulick
    @ffxsam
    however, with the phone number example, if I do this: ph = _.find(user.phones, { number: 12345 }) and then do user.pull('phones', ph), that works.
    I have to pass the actual Astro object in for it to work as expected
    jagi
    @jagi
    @ffxsam show the schema
    Sam Hulick
    @ffxsam
    
    
    Oops
    jagi
    @jagi
    @ffxsam you can't pull partial object. You have to pass entire document to the pull method.
    Sam Hulick
    @ffxsam
    @jagi Ahh ok, I was under the impression I could pull by matching a single field. thanks!
    Tsegaselassie Tadesse
    @tsega

    In my validation message I’m using TAPi18n strings as follows but all I’m getting is the default english version:

    username: [
                Validators.required(null, TAPi18n.__('provideUsernameMessage', null, 'am')),
                Validators.string(),
                Validators.minLength(5, TAPi18n.__('usernameShortMessage', null, "am"))
            ],

    It should be giving out the error message in Amharic, i.e. “የተጠቃሚ ስሙን ያስገብ” and “የተጠቃሚ ስሙ ፊደሎች ከ5 ወይም ከ5 በላይ መሆን አለባቸው”. I’ve tried elsewhere on the server side these messages do appear. How can I fix this?

    Sam Hulick
    @ffxsam
    does anyone know if there's a way to retrieve the class that an item belongs to?
    for example:
    t = Things.findOne();
    // t.getClass() === 'Thing'
    Sam Hulick
    @ffxsam
    the closest I can do is t instanceof Thing which is decent.. though it means I'd have to manually check all my Astro classes.
    @jagi any suggestions would be greatly appreciated! (whenever you have time of course) :)
    Jay Cheroske
    @jcheroske
    Anyone know if there's a setting that causes Astronomy to keep properties that are missing from the schema, instead of discarding them?
    Tsegaselassie Tadesse
    @tsega
    @jagi don't know if you've notice it but http://astronomy.jagi.io/ is down. Any hope of getting the docs up?
    jagi
    @jagi
    @ffxsam You can do t.constructor.getName()
    @tsega Documentation can be temporarily found under this address http://jagi.github.io/meteor-astronomy/v1
    @jcheroske no it's not possible not to discard non schema fields. It's how schemas work
    Sam Hulick
    @ffxsam
    @jagi awesome, thanks!
    Joe
    @joetidee
    HI
    When defining fields, is there a way to state that a field is an array of strings?
    Tsegaselassie Tadesse
    @tsega
    @jagi thanks!
    jagi
    @jagi

    @joetidee yes it's possible but the way you do it depends on a version of Astronomy
    in v1

    emails: {
      type: 'array',
      nested: 'string'
    }

    in v2

    emails: {
      type: [String]
    }
    Joe
    @joetidee
    thank you. so similar syntax to SimpleSchema. How do I then define the contraints for the contents of an array of Objects?
    p.s. how do I install Astronoy v2 - Meteor only seems to want to give me v1 ?
    Joe
    @joetidee
    Is there support for atomic counters, i.e. using getNextSequence("CounterName") if the insert/update queries?
    janek
    @jbbr

    @jagi Hello, I've a question about astronomy v2.
    Is it somehow possible to synchronously validate fields on the client?

    I used to do in v1:

    var isValid = someObj.validate('someField')

    In v2 it seems to be:

    someObj.validate({fields: ['someField']}, (err) => { ... });

    As I'm using the result of .validate( in form validation, it's somewhat difficult to rewrite it for asynchronous handling.

    Is there a reason for async validation other then server side processing? Maybe a way of doing client-only validation could be added?

    janek
    @jbbr

    Hm, looked in the code and it seems as server side validation is now somehow a must. Or am I overlooking something?
    Looks like client side validation can be disabled with simulation argument, but not server validation.

    I'm not yet convinced with this approach. I don't care if e.g the length of the first name of a user is valid according to the server. I'd like a check like this to be client only to be fast and easy for client only validations e.g for forms.

    When submitting the form I do care about server-side validation - but not before. Its extra load for the server for no good reason

    The file https://github.com/jagi/meteor-astronomy/blob/v2/lib/modules/validators/utils/document_validate.js seems to have the validation code I need. But it's not exported.
    jagi
    @jagi
    @jbbr I know it may be a problem that it validates on the server by default, maybe I'm gonna have to change that behavior. But it shouldn't be hard to just use callback function anyway.
    and you should be able to catch validation errors in the following way:
    try {
      doc.validate();
    } catch(err) {}
    however it's not going to return true/false value anymore
    and I'm not gonna change that
    janek
    @jbbr
    @jagi Yes, thanks. I figured out the try/catch way also.
    Only problem: looks like I get uncaught errors for fields I don't care about when using it.

    e.g:

    try {
          myObj.validate({fields: ['someField']});
        } catch (err) {
          console.error('Got error', err);
        }

    I get Something like:

    Uncaught Error: "someOtherField" is required [validation-error]
    The error for "someField" is catched properly
    I only want to check a specific field so thats problematic in my case
    janek
    @jbbr
    do you think this is a bug or is this intended behavior? If its a bug I will gladly create an issue
    jagi
    @jagi
    @jbbr hmmm it should work propery. You may create an issue
    jhuenges
    @jhuenges
    @jagi I read the validation part of the documentation, however I am not sure how to implement an equivalent custom() function like SimpleSchema has. Is there a possibilty to do so?
    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