products:
{ _id: 10, name: "Blue elephpant", category_ids: [ 4, 7 ] }
{ _id: 11, name: "Pink elephpant", category_ids: [ 4, 8 ] }

categories:
{ _id: 4, name: "toys",            product_ids: [ 10, 11 ] }
{ _id: 7, name: "everything blue", product_ids: [ 10 ] }
{ _id: 8, name: "everything pink", product_ids: [ 11 ] }
All categories for a given product (pink elephpant):

db.categories.find( { product_ids: 11 } );

All products for a given category (toys):

db.products.find( { category_ids: 4 } );

Updates need to be done in two collections