# Worked-out Example

#### Software Installation

* Install MongoDB Shell for Windows or Ubuntoo from [here](https://www.mongodb.com/try/download/shell).&#x20;
* Install MongoDB Compass GUI for Windows or Ubuntoo from [here](https://www.mongodb.com/try/download/compass). This a GUI for MongoDB Shell software that helps the database user to review and analysis the datasets available in the database.
* Instead you can directly use online compliers for practice. Try [OneCompiler](https://onecompiler.com/mongodb), [MyCompiler](https://www.mycompiler.io/new/mongodb), [Humongous Compiler](https://www.humongous.io/tools/playground/mongodb/new)

```sql
// Connect to MongoDB (assuming you're already connected)

// Create the Campus database if it doesn't exist
use("Campus");

// Define main collections
db.createCollection("campuses");
db.createCollection("departments");
db.createCollection("students");
db.createCollection("courses");

// Insert sample data into campuses collection
db.campuses.insertOne({
    name: "University of Tech",
    location: "Cityville",
    founded: 1950,
    website: "www.techuniversity.edu"
});

// Insert sample data into departments collection  
db.departments.insertMany([
    {name: "Computer Science", campusId: ObjectId("...")},
    {name: "Engineering", campusId: ObjectId("...")}
]);

// Insert sample data into students collection
db.students.insertOne({
    name: "John Doe",
    studentId: "S123456",
    department: ObjectId("..."),
    year: 3,
    gpa: 3.5
});

// Insert sample data into courses collection
db.courses.insertMany([
    {name: "Data Structures", campusId: ObjectId("..."), departmentId: ObjectId("...")},
    {name: "Algorithms", campusId: ObjectId("..."), departmentId: ObjectId("...")}
]);

//Insert 10 student information into students collection
db.students.insertMany([
  { name: "Alice Johnson", studentId: "S001", department: ObjectId("..."), year: 2, gpa: 3.8 },
  { name: "Bob Smith", studentId: "S002", department: ObjectId("..."), year: 3, gpa: 3.7 },
  { name: "Charlie Brown", studentId: "S003", department: ObjectId("..."), year: 1, gpa: 3.9 },
  { name: "David Lee", studentId: "S004", department: ObjectId("..."), year: 2, gpa: 3.6 },
  { name: "Eve Davis", studentId: "S005", department: ObjectId("..."), year: 3, gpa: 3.8 },
  { name: "Frank Williams", studentId: "S006", department: ObjectId("..."), year: 1, gpa: 3.7 },
  { name: "Grace Martin", studentId: "S007", department: ObjectId("..."), year: 2, gpa: 3.9 },
  { name: "Henry Thompson", studentId: "S008", department: ObjectId("..."), year: 3, gpa: 3.6 },
  { name: "Ivy Chen", studentId: "S009", department: ObjectId("..."), year: 1, gpa: 3.8 },
  { name: "Jack Harris", studentId: "S010", department: ObjectId("..."), year: 2, gpa: 3.7 }
]);

db.students.find();

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sai11101989.gitbook.io/iss_workbook/databases/unstructured-databases/worked-out-example.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
