// 1. Insert records into the 'author' collection
db.author.insertMany([
{ "authorID": 1, "firstName": "J.K.", "lastName": "Rowling" },
{ "authorID": 2, "firstName": "George", "lastName": "R.R. Martin" }
]);
// 2. Insert records into the 'book' collection
db.book.insertMany([
{ "bookID": 101, "title": "Harry Potter and the Philosopher's Stone", "genre": "Fantasy", "year": 1997 },
{ "bookID": 102, "title": "A Game of Thrones", "genre": "Epic Fantasy", "year": 1996 }
]);
// 3. Insert records into the 'bookauthor' collection
db.bookauthor.insertMany([
{ "bookID": 101, "authorID": 1 },
{ "bookID": 102, "authorID": 2 }
]);
// 4. Insert records into the 'member' collection
db.member.insertMany([
{ "memberID": 501, "firstName": "Nuzayh", "lastName": "Varachia", "joinDate": "2026-01-15" },
{ "memberID": 502, "firstName": "John", "lastName": "Doe", "joinDate": "2026-02-20" }
]);
// 5. Insert records into the 'borrowedbooks' collection
db.borrowedbooks.insertMany([
{ "borrowID": 901, "memberID": 501, "bookID": 101, "borrowDate": "2026-06-01", "returnDate": "2026-06-15" },
{ "borrowID": 902, "memberID": 502, "bookID": 102, "borrowDate": "2026-06-10", "returnDate": null }
]);
To embed this project on your website, copy the following code and paste it into your website's HTML: