Cannon.js has a neat little function which lets you set collision filter groups and masks on objects.
By going through my object creation functions and setting the groups they are in and masks that they can collide with I was able to solve this problem for example by setting the moons and planets like so:
Comets like this:
And container like this:
The collisionGrp and collisionMasks are both parameters passed on the container creation, like so:
I am able to determine whitch objects can be affected by other objects collision and forces.