Experimental Meteor 3 with Mongoose



  1. Meteor Grapher is being maintained by … between 0 and 1.5 developers. It is very cumbersome and it took me 3 days to update it for Meteor 3. The package is also missing proper types coverage. The learning curve for Grapher is very difficult and in today’s day and age relational data in MongoDB should not be rocket science or even more complex… Meteor Grapher science…
  2. Mongoose offers a massive API with +2M weekly downloads, stability and amazing documentation and it literally took me 10 minutes to fully understand relations .populate()
  3. Meteor classic query sistem and Collection methods can perfectly coexist with Mongoose and this is a plus for new devs coming to Meteor with previous Mongoose experience. Since Mongoose is 100% server side, there is 0 impact on the Meteor client.

activitree:mongoosed exposes the entire mongoose Api only server side as:

import { m } from 'meteor/activitree:mongoosed'

as well as a schema validator similar to SimplSchema({}).validator() for validating data in Meteor methods that call Mongoose functions.

activitree:mongoosed is installed as a local package for this experimental project. It will take some work to have a production ready and tested version.

Fetch the repo GitHub - activitree/mongoosed-demo: Mongoosed Demo

cd app
meteor npm i
meteor add activitree:mongoosed
meteor npm start

The project demonstrates:

  • use of a mix of local DB and a DB stored in Atlas (the connection is embedded in the repo)
  • find() with Meteor, find() with Mongoose
  • app/imports/api/server/collections → each folder has a readme file with a summary of what is used in the collection either the Meteor Collection methods or Mongoose or the mix.
  • use the browser console to see the schedules populating with relational data and teams populating with relational data including engineers (parent → child → child)
  • tasks are on a DB connection (local) while all other related data are on another DB connection (Atlas)

Simply put, in Mongoose you create a schema, use the schema to build a model, use the model to perform DB operations (see documentation at the top).

To do:

  • adapt the Mongoose to generate Meteor-like documet ids. Now, a “create” method is exported by activitree:mongoosed package in order to generate documents (insert) with the right _id format but would prefer to update Mongoose schema to generate and validated these ids properly. At the moment there is a small issue with relational queries where children of children throw a validation error.
  • for those interested, Mongoose fully supports change streams and will just need to pipe those through the socket to the client. I am personally not interested in pub/sub so if there is any interest for the concept, would be nice to have some code flowing in.
  • test in a production app.

This is looking great, Paul! Personally, I liked the concept behind Grapher and Theodor has put a lot of work in it to make it performant, but it soon became unclear what the future holds for it. Mongoose is a brilliant choice!

Thanks for your package. I am waiting this for along time.
:+1: :blush:

Dear Sir,
Have any update for this package :blush:

Hi @theara I am not sure what update you need for it. The package is published, ready to use.

1 Like

Thanks for your reply.
Support for Meteor v3?

This screen shot is from the Readme file of the package.
It uses the last Mongoose version compatible with Node14 for backwards compatibility with Meteor 2 but everything is compatible with later versions of Node and Meteor.

Very thanks, Waiting Meteor 3 release :pray: :blush: