Can we use astronomy class with accounts-twitter?


I am a bit new with astronomy and i really like it. I was wondering if anyone knew how to get the account-* packages to use the astronomy class, basically setting up a few default values in the new user document. Has anyone done this before? Anyone has any pointers on this?

@jagi ?


Unfortunately it won’t set default values when when using it with accounts-* packages because they are using direct collection access. However, it will change in Astronomy 2.0 which is in development.


What do you plan on doing in Astronomy 2.0 which will alter this behaviour?
I am guessing this is more related to the accounts-* packages, no?


Astronomy introduces new way of dealing with data. Instead doing Collection.insert() you do And most packages like accounts-* uses the first approach. In 1.0 I’ve also introduces partial support for direct collection access (Collection.insert()). But it’s very limited and only work when called from the class Class.insert() so packages like account-* does not use it. In 2.0 direct collection access is gonna work in Collection.insert(). More over Astronomy 2.0 is right now 23 times faster (in constructing and fetching data) then 1.0 so it’s a big improvement. There are gonna be many new features too.


Is there an ETA for Astronomy 2.0?

Do you think it’s a good idea to hook into LoggedIn and add the default values for the user, so maybe when i upgrade to 2.0 or when i fetch using astronomy everything plays well?


I hope I will finish it before Christmas.

Hmmm it depends on the use case. Most of the time, providing default values for such usecases does not give you any benefit. The only benefit is when you fetch documents from Meteor.users collection. It’s automatically transformed to Astronomy class and you can have methods, events etc. So if I would not use it for a default values.

However if you want to perform some extra action when user is created and this action, then I will use Astronomy for that. And it will work nice in 2.0.


Thanks jagi, keep up the good work. And as requested on github, if you could create a nodejs only compliant version of this package it would be super awesome.