Ignoring certain collisions

Hey box2ders. I'm wondering if there's a way to "ignore" certain collisions based on the user data of the body (or some other way). For instance if a body is fired it would interact with certain bodies, but non-fired objects wouldn't interact with those bodies. Hopefully that makes sense...

wish there was a way to group bodies.
hahaha literally right after I posted this I found out it's called "collision filtering" gonna look up a few things and see if I can figure it out. If anyone has some good example code though please let me know.

EDIT:

alright so filtering seems really easy, but how about changing a body's filter dynamically. Is that possible?
Hmm, doesn't seem to be working, can anyone see what I'm doing wrong?

Body 1:
Code:
var b2dGeneralPD:b2PolygonDef = new b2PolygonDef();
b2dGeneralPD.filter.categoryBits = 1;


Body2:
Code:
var b2dGeneralPD:b2PolygonDef = new b2PolygonDef();
b2dGeneralPD.filter.categoryBits = 2;


the 2 bodies are still colliding with each other. Is there anything else I have to set?
Ah cool, just got it, if anyone else is looking for how to change filters for bodies on the fly I made a little function

Code:
public static function change($body:b2Body, $vars:Object):void {
   var shape:b2Shape = $body.GetShapeList();
   var filter:b2FilterData = new b2FilterData();
   if($vars.categoryBits) { filter.categoryBits = $vars.categoryBits; }
   if($vars.maskBits) { filter.maskBits = $vars.maskBits; }
   shape.SetFilterData(filter);
}

Original thread: https://box2d.org/forum/viewtopic.php?t=4961