Using a static data set

Hello everyone. I’m currently working on an app for searching through World of Warcraft items based on their stats. So far I’m able to access the data using standard pub/sub and display it in a table. This data is going to be static and is only a couple MB in size, and I was wondering if there was a better way to get my data for querying in the client that avoids pub/sub completely, as I don’t need any sort of reactivity or ability to edit the data, and from what I’ve seen pub/sub would just be using extra resources on the server.

Ultimately, I’d like to have it so that when the user first visits the site, they can get a copy of the collection in in-browser storage, and then do all their queries against that local copy once it’s loaded into memory. If they already have a copy of the data and it is out of date for some reason (if I need to fix some incorrect values early on), I’d like it to update their local copy.

I hate the feeling that I’m over-engineering things. Any input is greatly appreciated.

Retrieve it with a meteor method and insert it in minimongo using a collection you define only client-side

Hi, thanks for the quick response. I was toying with it more last night but I couldn’t figure out how to get the data loaded into the client-side collection.

I defined the client-side collection like so,

EquipmentLocal = new Mongo.Collection(null);

and the server-sided collection like,

Equipment = new Mongo.Collection('Equipment');

My collection within Mongo is called Equipment and I was able to see my documents in the server-side collection when using pub/sub, but I’m confused as how I’m supposed to populate the Local one without publishing Equipment. Both of the above collections are defined in the ‘both’ folder of ‘startup’, should I be defining the named collection on both server and client and the local one only on client? I’m also not really sure what my Method is supposed to look like, and where I’m supposed to define/call it. I’m not on my dev PC at the moment but it looked something like this.

Meteor.methods ({
  'copyDb': function(){
      EquipmentLocal.insert(Equipment.find().fetch());
  }
})

This method is defined and called in that same ‘startup/both’ folder where I defined the collections, was just doing that temporarily to test.

client

const EquipmentLocal = new Mongo.Collection('Equipment_client');

Meteor.call('copyDb', (err, result) => {
  if (!err) result.forEach(r => EquipmentLocal.insert(r));
});

server

Meteor.methods ({
  copyDb() {
      return Equipment.find().fetch();
  }
})

Heck yeah, I think that’s it! For the local collection, I had to leave the name param as null though. But it seems to be working, my table is filling with the prop data populated by EquipmentLocal.find().fetch(). The only thing that seems strange now is that I can’t see any data in Minimongo collections in Meteor dev tools for Chrome. I won’t question it too much now that’s working though. Now to get this local collection saved in some sort of persistent storage, probably going to try GroundDB. Thanks very much for your help!