Zaid
Mongoose
JavaScript
100

Does Zaid wear Thoubs

No

100

What method is used to get one resource from the Database?

findOne()

100

What is the array method that checks if a value is in the array and returns a boolean?

includes()

200

What is Zaid's favorite Color?

Dark Blue
200

How many mandatory arguments does findByIdAndUpdate take?

2

200

Destructure the following object so that we can access the firstName and lastName

const myStudent = {

    firstName: 'Hussain',

    lastName:'Mandeel'

}

const {firstName, lastName} = myStudent 

300

What is Zaid's middle name?

Mohammad

300

Write on the board a method to get all the cars from the database with make=Toyota and isDrivable=true. Assume the model is Car

Car.find({make="Toyota",isDrivable=true})

300

Write the code to generate a random number between 0-10 (including 10)

Math.floor(Math.random() * 11)

400

How many instruments does Zaid play?

1

400

What do you add to the findByIdAndUpdate so it returns the updated object and not the original one?

{new:true}

400

What does this return?
[1, 2, 3].map(n => {n > 1})

[undefined, undefined, undefined]

500

How many hours has Zaid Flown? (+ or - 15)

325

500

Give a relationship between a Car model and user Model. 1 user can have many cars. Write it on the board with perfect syntax

    owner:{

        type: mongoose.Schema.Types.ObjectId,

        ref: 'Car',
    },

500

Given the following array write a nested loop to print all values from this array?

const myNestedNums = [[1,2,3],[4,5,6],[7,'zaid',8]]


for(let i = 0; i<myNestedNums.length; i++){

    for(let j = 0; j<myNestedNums[i].length; j++){

        console.log(myNestedNums[i][j])

    }

}

M
e
n
u