users with documents containing age and city, which query returns users older than 25 who live in New York?db.users.find({$and: [{age: {$gt: 25}}, {city: 'New York'}]})Option C uses $and to ensure both conditions are met: age > 25 and city is 'New York'. Option C works too because MongoDB implicitly ANDs conditions, but the question expects explicit use of logical operators. Option C uses $or, which returns documents matching either condition, not both. Option C is invalid because chaining find() like that does not work.
status is 'active' or score is greater than 80?db.records.find({$or: [{status: 'active'}, {score: {$gt: 80}}]})Option B correctly uses $or to find documents where either condition is true. Option B implicitly ANDs conditions, so it only returns documents where both are true. Option B explicitly ANDs conditions, same as A but more verbose. Option B is invalid because $in cannot mix values and operators like {$gt: 80}.
type is 'admin' and active is true?Option A has a syntax error: the first object in the $and array is missing a closing brace before the comma. This causes a syntax error. Options A, B, and C are syntactically correct.
$nor is preferred over using $not with $or in MongoDB queries?Option A is correct because $not negates only single expressions, so it cannot negate an entire $or with multiple conditions. $nor negates an array of conditions, returning documents where none match. Option A is incorrect because $not can be applied but only to single expressions, not to $or directly. Option A is false about performance and readability. Option A is false; $nor is not deprecated.
Option D uses $ne to exclude 'Boston' and $and to combine with age condition, which is clear and efficient. Option D misuses $not with $eq inside an object, which is valid but less readable and can be slower. Option D uses $nor incorrectly combined with age condition outside the array, which may cause unexpected results. Option D uses $nin with a single value array, which works but is less direct than $ne.