Skip to content

Instantly share code, notes, and snippets.

@arunoda
Forked from SachaG/searchPosts.js
Created July 31, 2013 01:20
Show Gist options
  • Save arunoda/6118555 to your computer and use it in GitHub Desktop.
Save arunoda/6118555 to your computer and use it in GitHub Desktop.
Meteor.methods({
searchPosts: function(term) {
console.log('-- searching for "'+term+'" --')
Future = Npm.require('fibers/future');
var fut = new Future();
Meteor._RemoteCollectionDriver.mongo.db.executeDbCommand({
"text": "posts",
search: term
}, function (error,results){
if (results && results.documents[0].ok === 1){
fut.ret(results);
}
});
return fut.wait();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment