cult-of-coders / grapher

Grapher: Meteor Collection Joins + Reactive GraphQL like queries
https://atmospherejs.com/cultofcoders/grapher
MIT License
275 stars 53 forks source link

feature/mongo-5 #467

Closed donstephan closed 2 years ago

donstephan commented 2 years ago

Fixes the main two issues with upgrades to Mongo 5:

  1. New wrapper for aggregations
  2. Counts being enforced with exposure rules #463

Also added in a docker-compose file for consistent environments with local development.

Lastly fixed some tests that reference maps since now Meteor uses actual Maps to represent local collections.

Twisterking commented 2 years ago

Hi @donstephan , great job there!

We are also using and relying heavily on Grapher in production and would like to upgrade to the newest Meteor version. I guess my question is:

Are you already using your changes in production on your end? Did any bugs/errors pop up?

Thanks a lot!

donstephan commented 2 years ago

Haven't used on production yet. I'm still not ready to make the bump to meteor 2.6+ yet. Grapher tests are passing using mongo 5 and it should be good to go but feel free to fork and test locally in your project as needed. If you have any issues just let me know and I'll get this PR updated.

Also meteor version 2.5.7 is a good step if you haven't upgraded to that yet. It gets you node 14 without this PR being finished.

paulincai commented 2 years ago

I use Grapher with Meteor 2.7.3 with no issues but I don't use publications, only queries.

vparpoil commented 2 years ago

Thank you ! This PR fix issues I had when updating to 2.7.3, related to aggregate function arguments.

MongoInvalidArgumentError: Method "collection.aggregate()" accepts at most two arguments 
at Collection.aggregate
[...]
(packages/cultofcoders:grapher/lib/aggregate.js:6:18)

@StorytellerCZ do you think this could be merged and published to atmosphere ? Thanks

StorytellerCZ commented 2 years ago

I'll look into publishing it today with some other things as well.

StorytellerCZ commented 2 years ago

See #466 for continuation of this.

Twisterking commented 1 year ago

Anyone ran into this error yet?

Exception while invoking method 'named_query_listsQuery' MongoInvalidArgumentError: Argument "options" must not be function

Got it after my update. any ideas on this?

paulincai commented 1 year ago

@Twisterking

" The method and publication names we create are: named_query_${queryName}, and as argument they accept the params object.

Meaning you can do:

Is there any chance that in a Meteor.call you forgot the params object and your call takes the callback as params?

Twisterking commented 1 year ago

I already found the culprit! It was https://github.com/meteorhacks/meteor-aggregate, a very old package I still had installed. This somehow interfered with the new grapher version (I guess maybe it overwrote Mongo.Collection.prototype.aggregate or something like this) and resulted in the error above.

tl;dr: Do NOT use https://github.com/meteorhacks/meteor-aggregate together with Grapher 1.4!

paulincai commented 1 year ago

@Twisterking I remember this one. The way it has been recently fixed in grapher can be seen here moving from v3 to v4. At that time I just dropped v3 all together. I'll take a look at meteor-aggregate see where this might pe coming from.

https://github.com/cult-of-coders/grapher/blob/master/lib/aggregate.js