What does db.collection.find() do in MongoDB?
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: "Retrieves documents from the collection". db.collection.find() là thao tác đọc, tức chữ R (Read) trong CRUD: nó nhận một bộ lọc (query filter) và tuỳ chọn projection để chọn trường, rồi trả về một cursor (con trỏ) duyệt qua các document khớp điều kiện; gọi find() không kèm bộ lọc sẽ lấy toàn bộ collection. Lệnh này không làm thay đổi dữ liệu nào. "Inserts a document into the collection" là việc của insertOne() hoặc insertMany(). "Updates a document in the collection" là việc của updateOne(), updateMany() hay replaceOne(), những lệnh nhận bộ lọc cùng toán tử cập nhật như $set. "Deletes a document from the collection" là việc của deleteOne() hoặc deleteMany(). Tên find nói đúng bản chất của nó: tìm và trả về, không thêm, sửa hay xoá document.
Cùng chương 4
What is MongoDB?Có lời giảiCâu hỏiWhat is the purpose of using regex in MongoDB queries?Có lời giảiCâu hỏiTo connecting to a MongoDB database and performing CRUD operations using the Node MongoDB Driver. Identify the parts responsible for connecting, inserting, and querying documents. (Choose 3 answers)Có lời giảiCâu hỏiCả 36 câu của chủ đề36 câu