Option to bypass MiniMongo and fetch directly from DB Server

Hi!

I have a button that prints out an excel report of some docs. I did some refactoring for pagination and now minimongo contains only a subset of the docs. This makes it so that the report is truncated. I’d like the report to get all docs from the server and not just the ones on the current page.

Was thinking to have the report functionality just use a method instead.

That’s perfectly fine, but I was wondering if there was an option to bypass Minimongo and fetch from the actual DB instead.

i.e.

Collection.find({},{skipMiniMongo:true})

No. There’s no such option. You could create an additional publication that publishes the data to a client side collection (see Collections and Schemas | Meteor Guide), but for this use case fetching with meteor methods is the way to go.

2 Likes

I’m realizing returning something like Collection.find({}).fetch() in a Method does not allow for the Client to access Collection Helpers though. Seems to be because the resultset is just an Array of Standard JS Objects and not Documents. Any solution for this, or is using Collection Helpers only possible through Pub/Sub ?

Ah, seems GitHub - dburles/meteor-collection-helpers: ⚙️ Meteor package that allows you to define helpers on your collections is what I needed…

So just

const regObjs = Collection.find({}).fetch();
const docs = regObjs.map(obj => Collection._transform(obj));