AS11


Mongo DB
Sleep NO 1

  1. A) Create a ‘Competition’ collection of documents with the following fields: [10 M]
    {Competition_Name: "….", Competition_Type: "….", Competition_Year:…,
    students:["….", "….","…." ]}
    In this, Competition_type can be ‘Sport’ or ‘Academic’.
    1. Insert at least 10 documents in a collection.

db.Competition.insertMany([
{
"Competition_Name": "Basketball Championship",
"Competition_Type": "Sport",
"Competition_Year": 2023,
"students": ["John Doe", "Jane Smith", "Emma Brown"]
},
{
"Competition_Name": "Math Olympiad",
"Competition_Type": "Academic",
"Competition_Year": 2022,
"students": ["Alice Johnson", "Bob Lee", "Chris Patel"]
},
{
"Competition_Name": "Football Tournament",
"Competition_Type": "Sport",
"Competition_Year": 2024,
"students": ["Michael Davis", "Sarah Wilson", "David Clark"]
},
{
"Competition_Name": "Science Fair",
"Competition_Type": "Academic",
"Competition_Year": 2023,
"students": ["James Turner", "Maria Lewis", "Sophia Kim"]
},
{
"Competition_Name": "Track and Field Meet",
"Competition_Type": "Sport",
"Competition_Year": 2022,
"students": ["Mark White", "Olivia Walker", "Daniel King"]
},
{
"Competition_Name": "Coding Hackathon",
"Competition_Type": "Academic",
"Competition_Year": 2024,
"students": ["Liam Harris", "Lucas Martinez", "Ella Robinson"]
},
{
"Competition_Name": "Tennis Open",
"Competition_Type": "Sport",
"Competition_Year": 2023,
"students": ["Zoe Adams", "Amelia Scott", "Lily Perez"]
},
{
"Competition_Name": "Debate Championship",
"Competition_Type": "Academic",
"Competition_Year": 2022,
"students": ["Ethan Green", "Isabella Young", "Mason Garcia"]
},
{
"Competition_Name": "Swimming Gala",
"Competition_Type": "Sport",
"Competition_Year": 2023,
"students": ["Benjamin Harris", "Emily Clark", "Sophia Evans"]
},
{
"Competition_Name": "Geography Bee",
"Competition_Type": "Academic",
"Competition_Year": 2024,
"students": ["Jacob Lewis", "Maya Harris", "Ella Walker"]
}
]);

2) Display all documents of ‘Competition’ collection in proper format.  	
 db.Competition.find().pretty();

{
"_id": ObjectId("..."),
"Competition_Name": "Basketball Championship",
"Competition_Type": "Sport",
"Competition_Year": 2023,
"students": ["John Doe", "Jane Smith", "Emma Brown"]
}
{
"_id": ObjectId("..."),
"Competition_Name": "Math Olympiad",
"Competition_Type": "Academic",
"Competition_Year": 2022,
"students": ["Alice Johnson", "Bob Lee", "Chris Patel"]
}
...

B) Solve the Following Queries: [15 M]

  1. Display all ‘Sport’ competition details which were held between years 2018 to 2019.
    db.Competition.find({
    "Competition_Type": "Sport",
    "Competition_Year": { gte:2018,gte: 2018, lte: 2019 }
    }).pretty();

  2. Display number of students participated in ‘Running’ competition which was conducted in year 2019.
    db.Competition.aggregate([
    { match: { "Competition_Name": "Running", "Competition_Year": 2019 } }, { project: { "students_count": { size:"size: "students" } } }
    ]);

  3. Update Competition_name of ‘Programming Competition’ to ‘Online Programming Competition’ for year 2020.
    db.Competition.updateOne(
    { "Competition_Name": "Programming Competition", "Competition_Year": 2020 },
    { $set: { "Competition_Name": "Online Programming Competition" } }
    );

  4. Add one more name of student ‘Prashant Mane’ in ‘Project Competition’ of year 2023.
    db.Competition.updateOne(
    { "Competition_Name": "Project Competition", "Competition_Year": 2023 },
    { $push: { "students": "Prashant Mane" } }
    );

  5. Sort Competition collection in ascending order of Competition_Year
    db.Competition.find().sort({ "Competition_Year": 1 }).pretty();

Sleep NO 2

  1. A) Model the following books system as a document database. [10 M]

Consider a set of books and publishers. A publisher can publish more than one book. Assume appropriate attributes and collections as per the query requirements.
Insert at least 10 documents in each collection.
db.Publishers.insertMany([
{
"_id": ObjectId("..."),
"publisher_name": "O Reilly",
"location": "Mumbai",
"books_published": [
ObjectId("..."), // reference to Book ID
ObjectId("...")
]
},
{
"_id": ObjectId("..."),
"publisher_name": "Pearson",
"location": "Pune",
"books_published": [
ObjectId("...")
]
},
{
"_id": ObjectId("..."),
"publisher_name": "McGraw Hill",
"location": "Bangalore",
"books_published": [
ObjectId("...")
]
},
{
"_id": ObjectId("..."),
"publisher_name": "Wiley",
"location": "Mumbai",
"books_published": [
ObjectId("...")
]
},
// Add more publishers...
]);

db.Books.insertMany([
{
"_id": ObjectId("..."),
"title": "Learning Python",
"author": "Yashwant Kanetkar",
"language": ["English"],
"cost": 1200,
"year": 2017,
"publisher_id": ObjectId("...") // Reference to O Reilly Publisher
},
{
"_id": ObjectId("..."),
"title": "Data Science for Beginners",
"author": "John Doe",
"language": ["English"],
"cost": 1500,
"year": 2020,
"publisher_id": ObjectId("...") // Reference to Pearson Publisher
},
{
"_id": ObjectId("..."),
"title": "Advanced Java Programming",
"author": "Yashwant Kanetkar",
"language": ["English", "Marathi"],
"cost": 800,
"year": 2017,
"publisher_id": ObjectId("...") // Reference to McGraw Hill Publisher
},
{
"_id": ObjectId("..."),
"title": "Modern Web Development",
"author": "Michael Scott",
"language": ["English"],
"cost": 2000,
"year": 2019,
"publisher_id": ObjectId("...") // Reference to Wiley Publisher
},
{
"_id": ObjectId("..."),
"title": "Introduction to Algorithms",
"author": "Thomas H. Cormen",
"language": ["English"],
"cost": 2500,
"year": 2018,
"publisher_id": ObjectId("...") // Reference to O Reilly Publisher
},
// Add more books...
]);

B) Answer the following Queries. [15 M]
1) List all Publishers which are located in Mumbai.
db.Publishers.find({ "location": "Mumbai" }).pretty();

 2) List the details of books with a cost >1000. 
      db.Books.find({ "cost": { $gt: 1000 } }).pretty();

 3) List all the book which are written by “Yashwant Kanetkar” and published in 2017. 
     db.Books.find({
"author": "Yashwant Kanetkar",
"year": 2017

}).pretty();

 4) List all the books published by “O Reilly” and are written either in English or Marathi. 
       db.Books.aggregate([
{
    $lookup: {
        from: "Publishers",
        localField: "publisher_id",
        foreignField: "_id",
        as: "publisher_info"
    }
},
{
    $match: {
        "publisher_info.publisher_name": "O Reilly",
        $or: [
            { "language": "English" },
            { "language": "Marathi" }
        ]
    }
}

]).pretty();

Sleep NO 3

  1. A) Model the following Tours information as a document database. [10 M]
    A tour will consider the source and destination. Destination may be all around the world. The tours are planned using different tourism industries. The industries provide the complete information before selecting a particular package. Customers select different packages according to their requirements and can rate/review the tourism industry.
    Assume appropriate attributes and collections as per the query requirements.
    Insert at least 10 documents in each collection.
    db.TourismIndustry.insertMany([
    {
    industry_name: "Kesari",
    head_office: "Mumbai",
    rating: 4.8,
    contact: "022-12345678",
    reviews: ["Excellent service", "Good guides", "Loved the hotels"]
    },
    {
    industry_name: "MakeMyTrip",
    head_office: "Delhi",
    rating: 4.5,
    contact: "011-98765432",
    reviews: ["Affordable", "Wide packages", "Decent service"]
    },
    {
    industry_name: "Thomas Cook",
    head_office: "Chennai",
    rating: 4.3,
    contact: "044-77665544",
    reviews: ["Organized tours", "Great planning"]
    },
    {
    industry_name: "Yatra",
    head_office: "Gurgaon",
    rating: 4.2,
    contact: "0124-1234567",
    reviews: ["Smooth booking", "Helpful staff"]
    },
    {
    industry_name: "TravelTriangle",
    head_office: "Noida",
    rating: 4.1,
    contact: "0120-4567890",
    reviews: ["Flexible packages", "Good pricing"]
    },
    {
    industry_name: "Cox & Kings",
    head_office: "Mumbai",
    rating: 4.0,
    contact: "022-66778899",
    reviews: ["Experienced guides", "Value for money"]
    },
    {
    industry_name: "SOTC",
    head_office: "Ahmedabad",
    rating: 3.9,
    contact: "079-99887766",
    reviews: ["Group travel", "Good deals"]
    },
    {
    industry_name: "Expedia India",
    head_office: "Bangalore",
    rating: 4.4,
    contact: "080-55667788",
    reviews: ["Online booking", "Easy cancellation"]
    },
    {
    industry_name: "TripFactory",
    head_office: "Hyderabad",
    rating: 3.8,
    contact: "040-11223344",
    reviews: ["Budget friendly", "Nice experience"]
    },
    {
    industry_name: "TravelGuru",
    head_office: "Pune",
    rating: 3.7,
    contact: "020-33445566",
    reviews: ["Local experts", "Great recommendations"]
    }
    ]);

db.Packages.insertMany([
{
package_id: "PK001",
industry_name: "Kesari",
source: "Mumbai",
destination: "Shimla",
duration_days: 5,
price: 15000,
inclusions: ["Travel", "Stay", "Food", "Sightseeing"]
},
{
package_id: "PK002",
industry_name: "Kesari",
source: "Mumbai",
destination: "Manali",
duration_days: 6,
price: 18000,
inclusions: ["Travel", "Stay", "Food"]
},
{
package_id: "PK003",
industry_name: "MakeMyTrip",
source: "Delhi",
destination: "Goa",
duration_days: 4,
price: 20000,
inclusions: ["Stay", "Sightseeing"]
},
{
package_id: "PK004",
industry_name: "Thomas Cook",
source: "Chennai",
destination: "Singapore",
duration_days: 7,
price: 55000,
inclusions: ["Flight", "Hotel", "City Tour"]
},
{
package_id: "PK005",
industry_name: "Yatra",
source: "Delhi",
destination: "Dubai",
duration_days: 6,
price: 48000,
inclusions: ["Flight", "Hotel", "Desert Safari"]
},
{
package_id: "PK006",
industry_name: "TravelTriangle",
source: "Pune",
destination: "Kerala",
duration_days: 5,
price: 22000,
inclusions: ["Houseboat", "Hotel", "Travel"]
},
{
package_id: "PK007",
industry_name: "Cox & Kings",
source: "Mumbai",
destination: "Europe",
duration_days: 10,
price: 120000,
inclusions: ["Flights", "Hotels", "Meals", "Guided Tours"]
},
{
package_id: "PK008",
industry_name: "SOTC",
source: "Ahmedabad",
destination: "Jaipur",
duration_days: 3,
price: 9000,
inclusions: ["Hotel", "Transport", "Guide"]
},
{
package_id: "PK009",
industry_name: "Expedia India",
source: "Bangalore",
destination: "Thailand",
duration_days: 6,
price: 35000,
inclusions: ["Flight", "Hotel", "Local Travel"]
},
{
package_id: "PK010",
industry_name: "TravelGuru",
source: "Hyderabad",
destination: "Ladakh",
duration_days: 7,
price: 30000,
inclusions: ["Travel", "Stay", "Sightseeing", "Permit"]
}
]);

db.Customers.insertMany([
{
customer_id: "C001",
name: "John",
email: "[email protected]",
phone: "9876543210",
trips: [
{ package_id: "PK001", destination: "Shimla", amount_paid: 15000 },
{ package_id: "PK004", destination: "Singapore", amount_paid: 55000 },
{ package_id: "PK009", destination: "Thailand", amount_paid: 35000 }
]
},
{
customer_id: "C002",
name: "Aditi",
email: "[email protected]",
phone: "9988776655",
trips: [
{ package_id: "PK005", destination: "Dubai", amount_paid: 48000 }
]
},
{
customer_id: "C003",
name: "Ravi",
email: "[email protected]",
phone: "9123456789",
trips: [
{ package_id: "PK006", destination: "Kerala", amount_paid: 22000 },
{ package_id: "PK010", destination: "Ladakh", amount_paid: 30000 }
]
},
{
customer_id: "C004",
name: "Sneha",
email: "[email protected]",
phone: "9012345678",
trips: [
{ package_id: "PK002", destination: "Manali", amount_paid: 18000 }
]
},
{
customer_id: "C005",
name: "Aman",
email: "[email protected]",
phone: "9090909090",
trips: [
{ package_id: "PK003", destination: "Goa", amount_paid: 20000 },
{ package_id: "PK008", destination: "Jaipur", amount_paid: 9000 }
]
},
{
customer_id: "C006",
name: "Priya",
email: "[email protected]",
phone: "8888888888",
trips: [
{ package_id: "PK001", destination: "Shimla", amount_paid: 15000 }
]
},
{
customer_id: "C007",
name: "Kunal",
email: "[email protected]",
phone: "7777777777",
trips: [
{ package_id: "PK007", destination: "Europe", amount_paid: 120000 }
]
},
{
customer_id: "C008",
name: "Meera",
email: "[email protected]",
phone: "6666666666",
trips: [
{ package_id: "PK010", destination: "Ladakh", amount_paid: 30000 }
]
},
{
customer_id: "C009",
name: "Raj",
email: "[email protected]",
phone: "9555555555",
trips: [
{ package_id: "PK001", destination: "Shimla", amount_paid: 15000 },
{ package_id: "PK006", destination: "Kerala", amount_paid: 22000 }
]
},
{
customer_id: "C010",
name: "Simran",
email: "[email protected]",
phone: "9444444444",
trips: [
{ package_id: "PK005", destination: "Dubai", amount_paid: 48000 }
]
}
]);

B) Solve the Following Queries: [15 M]

  1. List the details of packages provided by “Kesari”.
    db.Packages.find({ industry_name: "Kesari" }).pretty();

  2. List the highest rated tourism industry.
    db.TourismIndustry.find().sort({ rating: -1 }).limit(1).pretty();

    1. List all the details of expenses made by John on his first 3 trips. Also display the total expenses.
      let john = db.Customers.findOne({ customer_name: "John" });
      let firstThreeTrips = john.trips.slice(0, 3);
      let totalExpense = firstThreeTrips.reduce((sum, trip) => sum + trip.expense, 0);

print("First 3 trips of John:");
printjson(firstThreeTrips);
print("Total Expense: ₹" + totalExpense);

4) List the names of the customers who went on a tour to Shimla.

db.Customers.find(
{ "trips.destination": "Shimla" },
{ customer_name: 1, _id: 0 }
);

Sleep NO 4

  1. A) Model the following blog database with the following requirements: [10 M]

Every post has the unique title, description and url, Every post can have one or more tags, Every post has the name of its publisher and total number of likes, Every post has comments given by users along with their name, message, data-time and likes. On each post, there can be zero or more comments.
Assume appropriate attributes and collections as per the query requirements.
Insert at least 10 documents in each collection
db.Blogs.insertMany([
{
"title": "Exploring the Culinary Delights of Italy",
"description": "A journey through Italy's rich culinary traditions.",
"url": "https://example.com/blogs/culinary-delights-italy",
"tags": ["food", "travel"],
"publisher": "Amrita",
"total_likes": 150,
"comments": [
{
"name": "Sarika",
"message": "Amazing insights! Loved the pasta recipe.",
"date_time": ISODate("2023-05-15T08:30:00Z"),
"likes": 10
},
{
"name": "Raj",
"message": "Can't wait to try these dishes!",
"date_time": ISODate("2023-05-16T09:00:00Z"),
"likes": 5
}
]
},
{
"title": "A Guide to Backpacking Across Europe",
"description": "Essential tips and routes for backpackers in Europe.",
"url": "https://example.com/blogs/backpacking-europe",
"tags": ["travel", "adventure"],
"publisher": "John",
"total_likes": 200,
"comments": [
{
"name": "Emily",
"message": "This is exactly what I needed for my trip!",
"date_time": ISODate("2023-06-10T10:15:00Z"),
"likes": 20
}
]
},
{
"title": "The Art of French Pastry Making",
"description": "Delving into the techniques behind exquisite French pastries.",
"url": "https://example.com/blogs/french-pastry-art",
"tags": ["food", "art"],
"publisher": "Amrita",
"total_likes": 180,
"comments": [
{
"name": "Sarika",
"message": "The croissant recipe is a game changer!",
"date_time": ISODate("2023-07-01T14:45:00Z"),
"likes": 15
}
]
},
{
"title": "Solo Travel: Embracing the Freedom",
"description": "Personal experiences and tips for solo travelers.",
"url": "https://example.com/blogs/solo-travel-freedom",
"tags": ["travel", "solo"],
"publisher": "Raj",
"total_likes": 120,
"comments": [
{
"name": "Anita",
"message": "Your journey is truly inspiring!",
"date_time": ISODate("2023-08-05T16:00:00Z"),
"likes": 8
}
]
},
{
"title": "Vegan Recipes for a Healthy Lifestyle",
"description": "Delicious and nutritious vegan recipes to try at home.",
"url": "https://example.com/blogs/vegan-recipes-health",
"tags": ["food", "health"],
"publisher": "Priya",
"total_likes": 220,
"comments": [
{
"name": "Sarika",
"message": "The lentil soup is my new favorite!",
"date_time": ISODate("2023-08-20T18:30:00Z"),
"likes": 25
}
]
},
{
"title": "Culinary Traditions of Southeast Asia",
"description": "Exploring the diverse flavors and dishes of Southeast Asia.",
"url": "https://example.com/blogs/southeast-asia-culinary",
"tags": ["food", "travel"],
"publisher": "Amrita",
"total_likes": 160,
"comments": [
{
"name": "Sarika",
"message": "The street food guide is spot on!",
"date_time": ISODate("2023-09-10T20:00:00Z"),
"likes": 12
}
]
},
{
"title": "Adventures in the Swiss Alps",
"description": "A travelogue of hiking and skiing in the Swiss Alps.",
"url": "https://example.com/blogs/swiss-alps-adventures",
"tags": ["travel", "adventure"],
"publisher": "John",
"total_likes": 190,
"comments": [
{
"name": "Emily",
"message": "The hiking trails look breathtaking!",
"date_time": ISODate("2023-09-15T22:00:00Z"),
"likes": 18
}
]
},
{
"title": "Mastering the Art of Sushi Making",
"description": "Step-by-step guide to creating authentic sushi at home.",
"url": "https://example.com/blogs/sushi-making-guide",
"tags": ["food", "art"],
"publisher": "Amrita",
"total_likes": 170,
"comments": [
{
"name": "Sarika",
"message": "I tried the maki rolls, and they were a hit!",
"date_time": ISODate("2023-10-01T12:30:00Z"),
"likes": 10
}
]
},
{
"title": "Exploring the Temples of Kyoto",
"description": "A cultural journey through Kyoto's historic temples.",
"url": "https://example.com/blogs/kyoto-temples-exploration",
"tags": ["travel", "culture"],
"publisher": "Raj",
"total_likes": 110,
"comments": [
{
"name": "Anita",
"message": "Your photos capture the serenity of the temples.",
"date_time": ISODate("2023-10-10T14:00:00Z"),
"likes": 5
}
]
}
]);
B) Answer the following Queries: [15 M]

  1. List all the blogs which are tagged as food blogs.
    db.Blogs.find({ tags: "food" }).pretty();

  2. List all the blogs that are posted by “Amrita”.
    db.Blogs.find({ publisher: "Amrita" }).pretty();

  3. List all the blogs that are tagged a “travel blogs” and were created before 2024 and are have comments written by “Sarika” and commented as “like”
    db.Blogs.find({
    tags: "travel",
    "comments.name": "Sarika",
    "comments.message": "like",
    "comments.date_time": { $lt: ISODate("2024-01-01T00:00:00Z") }
    }).pretty();

  4. List all the blogs that have comments which are posted before August 2019 or are not liked by the user posting the comment.
    db.Blogs.find({
    or: [ { "comments.date_time": { lt: ISODate("2019-08-01T00:00:00Z") } },
    { "comments.likes": { $lt: 1 } }
    ]
    }).pretty();

Sleep NO 5

  1. A) Create an ‘Institute’ collection of documents with the following fields. [10 M]

{ Name:"….", City:"….",No_of_faculties:….,Est_Year:….,
Courses:[{Course_Name:"….", Dur_in_month:….,Fees:….},…]
}

  1. Insert at least 10 documents in a collection.
    db.Institute.insertMany([
    {
    "Name": "Disha Institute",
    "City": "Pune",
    "No_of_faculties": 8,
    "Est_Year": 2015,
    "Courses": [
    { "Course_Name": "Data Science", "Dur_in_month": 12, "Fees": 50000 },
    { "Course_Name": "Machine Learning", "Dur_in_month": 10, "Fees": 45000 }
    ]
    },
    {
    "Name": "Techno Academy",
    "City": "Mumbai",
    "No_of_faculties": 15,
    "Est_Year": 2008,
    "Courses": [
    { "Course_Name": "Artificial Intelligence", "Dur_in_month": 14, "Fees": 60000 },
    { "Course_Name": "Cyber Security", "Dur_in_month": 12, "Fees": 55000 }
    ]
    },
    {
    "Name": "Innovative Learning Center",
    "City": "Nashik",
    "No_of_faculties": 10,
    "Est_Year": 2012,
    "Courses": [
    { "Course_Name": "Cloud Computing", "Dur_in_month": 16, "Fees": 70000 },
    { "Course_Name": "Big Data Analytics", "Dur_in_month": 18, "Fees": 75000 }
    ]
    },
    {
    "Name": "Future Skills Institute",
    "City": "Nagpur",
    "No_of_faculties": 12,
    "Est_Year": 2010,
    "Courses": [
    { "Course_Name": "Blockchain Technology", "Dur_in_month": 15, "Fees": 65000 },
    { "Course_Name": "Internet of Things", "Dur_in_month": 13, "Fees": 60000 }
    ]
    },
    {
    "Name": "Global Tech University",
    "City": "Pune",
    "No_of_faculties": 20,
    "Est_Year": 2005,
    "Courses": [
    { "Course_Name": "Robotics", "Dur_in_month": 18, "Fees": 80000 },
    { "Course_Name": "Quantum Computing", "Dur_in_month": 20, "Fees": 90000 }
    ]
    },
    {
    "Name": "Bright Future College",
    "City": "Pune",
    "No_of_faculties": 5,
    "Est_Year": 2018,
    "Courses": [
    { "Course_Name": "Digital Marketing", "Dur_in_month": 6, "Fees": 30000 },
    { "Course_Name": "Graphic Designing", "Dur_in_month": 8, "Fees": 35000 }
    ]
    },
    {
    "Name": "Tech Savvy Institute",
    "City": "Mumbai",
    "No_of_faculties": 18,
    "Est_Year": 2016,
    "Courses": [
    { "Course_Name": "Full Stack Development", "Dur_in_month": 24, "Fees": 100000 },
    { "Course_Name": "Data Analytics", "Dur_in_month": 14, "Fees": 70000 }
    ]
    },
    {
    "Name": "Innovators Hub",
    "City": "Nashik",
    "No_of_faculties": 8,
    "Est_Year": 2014,
    "Courses": [
    { "Course_Name": "Mobile App Development", "Dur_in_month": 12, "Fees": 50000 },
    { "Course_Name": "Game Development", "Dur_in_month": 16, "Fees": 60000 }
    ]
    },
    {
    "Name": "Advanced Learning Institute",
    "City": "Nagpur",
    "No_of_faculties": 10,
    "Est_Year": 2011,
    "Courses": [
    { "Course_Name": "AI and Deep Learning", "Dur_in_month": 18, "Fees": 80000 },
    { "Course_Name": "Data Visualization", "Dur_in_month": 12, "Fees": 60000 }
    ]
    },
    {
    "Name": "Creative Minds Academy",
    "City": "Mumbai",
    "No_of_faculties": 6,
    "Est_Year": 2019,
    "Courses": [
    { "Course_Name": "UI/UX Design", "Dur_in_month": 10, "Fees": 40000 },
    { "Course_Name": "Video Editing", "Dur_in_month": 8, "Fees": 35000 }
    ]
    }
    ]);
  2. Display all documents of ‘Institute’ collection in proper format
    db.Institute.find().pretty();

B) Answer the following Queries. [15 M]
1) Give all institute names whose establishment year is before 2010.
db.Institute.find({ Est_Year: { $lt: 2010 } }, { Name: 1, _id: 0 });

  1. Display Institute details having Course ‘Artificial Intelligence’.
    db.Institute.find({ "Courses.Course_Name": "Artificial Intelligence" });

  2. Update No_of_faculties of ‘Disha’ Institute to 10.
    db.Institute.updateOne(
    { Name: "Disha Institute" },
    { $set: { No_of_faculties: 10 } }
    );

  3. Display the latest three Institutes established in easy-to-read format.
    db.Institute.find().sort
    ::contentReference[oaicite:0]{index=0}

    1. Count the number of Institutes in ‘Pune’ city, established after 2023.
      db.Institute.countDocuments({
      City: "Pune",
      Est_Year: { $gt: 2023 }
      });