Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Model layer for Meteor
Astronomy for Meteor (the jagi:astronomy package) is a model-layer library for the Meteor platform that turns plain MongoDB documents into schema-defined classes with field validation, change tracking, and automatic persistence.
Astronomy for Meteor is an Object Document Mapping (ODM) / Object-Relational Mapping (ORM) system that introduces a Model Layer to Meteor applications. It takes a MongoDB collection and a schema definition (fields, types, validators, behaviors) and produces a Class whose instances wrap documents with extra logic. The package is installed with meteor add jagi:astronomy, is developed by the GitHub user jagi, and is released under the MIT License.
Class.create, specifying a name, a MongoDB collection, fields with types and validators, and behaviors; the schema is declared once and reused across the app.minLength with a parameter value, so documents are checked before saving; the example schema rejects post titles shorter than 3 characters.Date or String) and Astronomy handles conversion when you call save().save() method detects which fields have changed and runs an update with only the modified fields on the underlying collection.timestamp to automatically manage createdAt and updatedAt fields on each document.Post.findOne(id) on the class instead of the raw collection, returning an instance with model logic rather than a plain object.save() call.Post class with a title field that must be at least 3 characters, a userId, and a publishedAt date, then reuse it everywhere.timestamp behavior so every created and updated document gets createdAt and updatedAt values without manual assignment.Install the package with meteor add jagi:astronomy, import Class from meteor/jagi:astronomy, define a schema that names the class, points to a MongoDB collection, and declares fields plus validators, then call save() on instances. Internally the class wraps the collection's findOne, insert, and update methods to apply validation and change tracking.
Yes, the package is open source and released under the MIT License, so it is free to use in commercial and personal projects.
Run meteor add jagi:astronomy from your Meteor project directory. The package is hosted on Atmosphere, Meteor's package registry.
save() method do?save() validates all fields on the model instance according to the schema, then updates the underlying MongoDB document with only the fields that have changed, leaving unchanged fields untouched.
Not by default, but the timestamp behavior can be enabled in the schema, which automatically sets createdAt and updatedAt fields.
Documentation is available at jagi.github.io/meteor-astronomy, and the author publishes weekly video tutorials linked from the GitHub README.
