Does Zaid wear Thoubs
No
What method is used to get one resource from the Database?
findOne()
What is the array method that checks if a value is in the array and returns a boolean?
includes()
What is Zaid's favorite Color?
How many mandatory arguments does findByIdAndUpdate take?
2
Destructure the following object so that we can access the firstName and lastName
const myStudent = {
firstName: 'Hussain',
lastName:'Mandeel'
}
const {firstName, lastName} = myStudent
What is Zaid's middle name?
Mohammad
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})
Write the code to generate a random number between 0-10 (including 10)
Math.floor(Math.random() * 11)
How many instruments does Zaid play?
1
What do you add to the findByIdAndUpdate so it returns the updated object and not the original one?
{new:true}
What does this return?
[1, 2, 3].map(n => {n > 1})
[undefined, undefined, undefined]
How many hours has Zaid Flown? (+ or - 15)
325
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',
},
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])
}
}