<slide>
<title>Many to Many (n:m)</title>

<example><![CDATA[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 ] }]]></example>

<blurb>All categories for a given product (pink elephpant):</blurb>
<example>db.categories.find( { product_ids: 11 } );</example>
<break/>

<blurb>All products for a given category (toys):</blurb>
<example>db.products.find( { category_ids: 4 } );</example>
<break/>

<blurb>Updates need to be done in two collections</blurb>
</slide>
