A sample part of the data structure is as follows: { _id:1, userIndex: 10, email: “arealeamil@notreallu.asd", retainRate:2} What would be the most likely statement that we would need to grab email info for user indexes greater than 24?
4 phương ánCó giải thích
Các phương án trả lời
Chọn một phương ánLời giảiChọn phương án để mở
Đáp án đúng: "
db.email.find({
userIndex:{
$gt:24
}
}, {email:1, _id:0})". Trong MongoDB, lệnh find nhận hai đối số: điều kiện lọc (query) và phép chiếu (projection). Yêu cầu là lọc theo trường userIndex lớn hơn 24 nên điều kiện phải là userIndex với toán tử $gt, và chỉ lấy email nên projection đặt email bằng 1 và tắt _id bằng 0. "
db.userIndex.find({
email:{
$gt:24
}
}, {_id:0})" đặt điều kiện lên email, so một địa chỉ thư với số 24, và projection trả mọi trường trừ _id. "
db.userIndex.find({
email:{
$lte:24
}
}, {_id:0})" vừa lọc nhầm trường email vừa dùng $lte (nhỏ hơn hoặc bằng), ngược chiều yêu cầu. "
db.email.find({
userIndex:{
$lte:24
}
}, {email:1, _id:0})" đúng trường và đúng phép chiếu nhưng $lte lấy các chỉ số từ 24 trở xuống, trái với điều kiện lớn hơn 24.
Cùng phần 6
Use the following table named "user_table" to answer the problems. userId username email 1 admin admin@corporate.moe 2 h4xor 1337@rawr.cte How would you go about querying the entire username column (however many)?Có lời giảiCâu hỏiConsider the following generic statement: db.<collection>.find(<query filter>, <projection>).<cursor modifier>. Which part of the statement would reflect that of the SELECT statement in SQL as illustrated in the lecture?Có lời giảiCâu hỏiWhat is the global indexing table?Có lời giảiCâu hỏiCả 10 câu của chủ đề10 câu
Xuất hiện trong 1 bộ đề
Đi tiếp từ đây