One-to-Many Step 12

This lesson is only available for PRO members. Sign-in and choose a plan below.

Monthly

$25/month
  • Unlimited course access
  • Cancel anytime
  • Slack #pro-member invite
  • AngularFirebase Survival Guide Book

Quarterly

$50/3mo
  • All monthly tier benefits
  • 33.33% discount
  • 🔥 Free Sticker

Lifetime

$300/one-time
  • All monthly tier Benefits
  • One-time payment
  • 🔥 Free sticker & 👔 T-Shirt

file_type_js_official firestore.js
const authorId = 'dr-seuss';

// 4. Embedded One-to-Many
const authorWithBooks = db.collection('authors').doc(authorId)


// 5. Subcollection
const books = db.collection('authors').doc(authorId).collection('books');


// 6. Root Collection, requires index
const booksFrom1971 = db.collection('books')
    .where('author', '==', authorId)
    .where('published', '>', 1971);

Q&A Chat