Grapher 1.3 has been released

@klabauter we only opened it so all donations will be redirected in form of bounty hunts to Grapher/Redis-Oplog.

@martineboh no problem, it’s been a pleasure working on it.

Hello guys I have some very shocking news, https://github.com/theodorDiaconu/grapher-performance I made a SQL version of it using sequelize and join-monster and using Meteor & Apollo. To finally see how Grapher really compares to SQL (a relational database)

This is just a teaser, the only thing I can say is that the results are jaw-dropping, and they’re going to be released in Meteor Night stream. :smiley:

6 Likes

Released Grapher 1.3.6

  • Support for Meteor 1.7 (The node driver got updated and AggregationCursor was returned instead of actual result)
  • One small BC change for reducers that were using links of type one (It’s not really a BC break it’s a bug fix, but people who relied on using the array[0] for advanced reducer usages will have issues)
2 Likes

Release Grapher 1.3.7

  • Support for edge-cases with reducers that use links
  • Sync fetching for named queries
  • Improved performance for direct links by 5x !

The last element is absolutely crazy! With some small tweaks we managed to squeeze even more performance out of Grapher. This means that if we compare it again to SQL we should see even faster response times, it’s crazy…

Anyway, the single fact that this can be used along-side Apollo GraphQL makes it a crown jewel.

We had at some point serious thoughts for migrating Grapher to NPM & Typescript. While this is very possible, it involves too many resources, it involves splitting Grapher into like 4 different packages and we are enjoying too much the Meteor package system, and we as a company do not need it.

10 Likes

I’ve just finished the Grapher docs and it looks amazing! One question: If I use collection-hooks and use grapher’s createQuery to fetch the data, will I be able to use the hooks on the returned elements? And will the client’s minimongo be populated automatically? Or only when the query is reactive (e.g. it’s a pub/sub)?

Minimongo is only populated on reactive queries. And regarding hooks, yes, it still uses the Meteor mongo library.

1 Like

Released 1.3.8

We come with a lot of stability fixes and edge-case handling, making Grapher more robust and more serious than ever.

Some nice things that were launched:

  • Fixes for $metadata links and cleaning up non-existing documents from links
  • Reducers can now safely use other reducers and properly compute them.
  • TypeScript types
  • Support for query projection operators
  • Some other small issues

This has been achieved thanks to the people in the community who have contributed and spent their time either working on a reproduction repo, either taking the courage and diving into the code and extend it.

Grapher is that kind of project close to my soul and many companies use it as their foundation for data fetching, and for a good reason.

Cheers!

15 Likes

Hi @diaconutheodor! Just a quick question: Is grapher still actively maintained? It seems very quiet lately. I remember you talked about a “super secret project” a few months ago. Is it a grapher replacement? Will it remain an internal project? What does it mean for the future of grapher?
I’m about to start a new project and don’t want to run into the “kadira trap” again…

Thanks!

1 Like

Grapher 1.3 is LTS until 2024. All critical bugs will be fixed. The other secret project actually makes use of Grapher. No further comments regarding it for now, its just going to be a blast!

9 Likes

When do you hope to release something?

Hi there, I use grapher myself and I like it. But I see a high usage of memory, which grows over time until the server is out of memory. If I use a cacher of 30 minutes, will the cache automatically released after 30 minutes of no use?

Best regards, HK

Maybe there’s a memory leak in the cacher, you can try to build your own, maybe using something like redis, so it can be also scale-able ?

Honestly I expect somewhere around September. It’s something that in my personal opinion rethinks the way we code from ground-up.

2 Likes

Thanks for your honest reply! :slight_smile:
It’s so much more useful than an optimistic one :+1::smiley:

I’m looking forward to see and try the result of your hard work! :slight_smile:

3 Likes

I wanted to use grapher because it seemed so easy. Are there any good ressources (githib repos, tutorials, articles?) in order to use redis for caching in combination with Meteor?

Released Grapher 1.13.11

Grapher is going strong, now with the latest release, finally supporting Nested Links field: "profile.userId". All thanks to the support of @bhunjadi. Performance was not impacted.

Code example: https://github.com/cult-of-coders/grapher/pull/355/files#diff-1c9aeb187c5968a5f25c12e3cf9a998f

We solved some interesting problems, and another interesting one appeared, that I would like some community feedback:

Cheers!

11 Likes

@diaconutheodor Awesome. Grapher has been a lifesaver in our work.

I do have one question though.

Is it possible to recursively apply retrieved values to the next level of nested levels.

Here’s a scenario:

I have 3 collections:

  1. Collection1 has a type:one link to Collection2
  2. Collection3 has a type:one link to Collection2
  3. Collection2 has inverse links to Collection1 and Collection3
  4. All 3 collections have startdate and enddate as fields

So, the idea is that I should be able to do a query to lookup on Collection1, and get something like:

{
   _id: xxx, // collection1 id,
   startdate: xxx,
   enddate: xxx,
   col2: [{
      _id: xxx //collection2 id,
      startdate: xxx,
      enddate: xxx,
      col3: [{
          _id: xxx // collection3 id
          startdate: xxx,
          enddate: xxx
      }]
   }]
}

Say I wanted to filter the lookups of Collection3 in the Collection2 object and only retrieve those between the startdate and enddate of that particular Collection2 object, could I do it with Grapher?

What I’m hoping for is a query like:

Collection1.createQuery({
    _id:1,
    startdate: 1,
    enddate:1,
    col2: {
        _id:1,
        startdate: 1,
        enddate:1,
        col3: {
            $filters: {
                $and: [
                    {startdate: {$gte: col2.startdate}},
                    {enddate: {$lte: col2.enddate}}
                ]            
            },
            _id:1,
            startdate: 1,
            enddate:1,
        }
    }
});

That way I can ensure that the col3 values are only those within the range of the col2 startdate and enddate.

I wasn’t clear on whether this was possible, and I tried using $postFilters, but in some cases it was removing the top level documents instead of just eliminating the excess documents at the col3 level.

Right now, for sake of convenience, I’m not applying these nested filter at the DB level, and manipulating the arrays in Javascript, but I’m having to do this at times at UI level which might lead to computation bloat.

I’m hoping there’s a better way to use Grapher’s power to make this easier.

Thanks again for such a great tool.

You could just use a reducer instead of col3 since filters are dynamic. And let’s use GitHub for issues/proposals like this. It’s better to manage it there!

Cheers, and glad you like Grapher!

2 Likes

Thanks and noted on using Github in future.

Hi @diaconutheodor,
I need some help here!
I have an array of objects and how do I make a link to a key of an object to another collection using Grapher?
Eg:
Users Collection:

{_id: 123, 
        addresses: [{
            location :"street1",
            category: "categoryId1"       
       },
      {
            location :"street2",
            category: "categoryId2"       
       }
   ]
}

Category Collection:

{
 _id:"categoryId1",
  name: "cateogory Name"
}
{
 _id:"categoryId2",
  name: "cateogory Name 2"
}

I did something like this

Meteor.users.addLinks({ 'cat': { type: 'one', collection: Category, field: 'addresses.category' } })
Meteor.users.createQuery({ $filters: {_id:"userId"}, "cat":{name:1} }).fetchOne();

The above one seems not working…

Thanks

Hi,

Any reason not to create a dedicated collection ?

You’d use denomalization afterward.
https://cult-of-coders.github.io/grapher/#Denormalization

HTH