How can I search in a big data collection on server side without publishing everything in meteor

Hey all! I’m a newbie to Meteor. I need to build up a text search system with typeahead-like feature using Meteor js. My collection on the server side has about 1 million words, so it’s impossible to publish them all (my page will take forever to load so I’m assuming the collection is so large that the sync takes forever). However, each time, my system needs to search within the whole collection. Anyone has suggestions about how to do this? Thanks a lot

Use Easysearch: https://github.com/matteodem/meteor-easy-search

You can get the functionality you want, plus it gives you options on data fetching sources: mongo-db, minimongo and others.

Hope that helps.

Male a server method which return the result of the query

Hey! Do you mean there’s no need to publish the collection but use Meteor.method to return the search result?

exactly. You can search within the method and then return an object with the data.

Gotcha. And it works! Thanks a lot