A collection in MongoDB is similar to a table in SQL. Both store groups of related data entries.
users with documents containing name and age, which query returns all users older than 25?db.users.find({ age: { $gt: 25 } })The MongoDB query db.users.find({ age: { $gt: 25 } }) matches the SQL query SELECT * FROM users WHERE age > 25; because both filter for age greater than 25.
name and age into the users collection?The correct MongoDB command to insert one document is insertOne(). Option C uses deprecated insert() which still works but is not recommended. Option C is SQL syntax. Option C is invalid.
orders with many documents. You often query orders by customerId. Which index improves query speed for db.orders.find({ customerId: 123 })?Indexing the customerId field speeds up queries filtering by that field. Indexing unrelated fields or using text indexes on numeric fields won't help.
db.products.find({ price: { $gt: 100 } }) but get no results, even though you know some products have price over 100. What is the most likely reason?If price is stored as a string, numeric comparison operators like $gt won't work as expected, causing no matches.
