performance - Meteor: How can I show questions only asked by users with the field 'active' -


i building quora of sorts.. , trying clean website. if user deletes profile, question remains there , display no user. trying link users.

what did added field on users db changes 'active 'inactive'(there no deletion).

so question how can query mongo can show questions users have 'active' tag on users db.

i have no idea how cross database query. right way , if how possible?

thanks!

you have couple of options, easiest mark questions inactive author becomes inactive. here's example deleteuser method:

meteor.methods({   deleteuser: function() {     // mark user inactive     meteor.users.update(this.userid, {$set: {isinactive: true}});      // mark user's questions inactive     questions.update(       {author: this.userid},       {$set: {isinactive: true}},       {multi: true}     );   } }); 

because data inactive authors has been propagated questions collection, publish function this:

meteor.publish('activequestions', function() {   // return active posts   return questions.find({isinactive: {$ne: true}}); }); 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -