Best option for the data-layer in Meteor?


#1

What is the best options for the data-layer (production ready) to use in Meteor?

Candidates:

  • Mongo & Collections
  • Graphql (what is a good client & server)
  • Apollostack

#2

Meteor + http://grapher.cultofcoders.com

:smiley:


#3

How is this better than the competitors?


#4

The advantages:

  • It’s a simple Meteor package. You just add the package and that’s it. You can incrementally adopt it. It blends in with SimpleSchema without any effort.
  • It has Relationship Manager for MongoDB. Makes creating relationships easily. You can even use it just for that.
  • It uses MongoDB aggregate framework to achieve very fast queries.
  • It can be used together with ApolloStack, for data fetching (They are not mutually exclusive, they can work very well together !)
  • It has advanced concepts for linking collections and fetching them without a lot of boilerplate: “Meta Relationships”
  • It is exponentially faster for deep nested graphs because it “assembles filters” and re-assembles the result them in the app, the reason for this is that for a graph like:
users: {
     posts: {
           comments: { ... }
     }
}

Instead of making 1 + (count(users)) + (count(users)*count(posts)) requests. It just makes 3. This leads to tremendous improvements to the database. You can easily reach 2000+ db requests for a deep nested graph.

  • It offers Exposure paradigms for securely exposing your data (Check Exposure and Named Queries)
  • A query can be fetched reactively or statically (via method), without any change.

The disadvantages:

  • While you can have resolver links that work very well with any kind of API, it doesn’t have that much support for other types of databases it only focuses on MongoDB and Meteor.
  • Resolver functions that communicate with other APIs are not Reactive.
  • The documentation could use some improvement.