Problem Statement
Which of the following is NOT a valid MongoDB data type?
Explanation
Float32 is not a valid MongoDB data type. MongoDB supports String, Number types like int, long, double, and Decimal128, Boolean, Date, Array, Object or Embedded Document, ObjectId, Null, Binary Data, Regular Expression, Timestamp, and Code.
The number types in MongoDB are int for 32-bit integers, long for 64-bit integers, double for floating-point numbers, and Decimal128 for high-precision decimal values. There is no Float32 type in MongoDB.
Code Solution
SolutionRead Only
// Valid MongoDB data types
{
name: "Alice", // String
age: 30, // Number (int)
salary: 75000.50, // Number (double)
active: true, // Boolean
joinDate: new Date(), // Date
skills: ["Java", "Python"], // Array
_id: ObjectId() // ObjectId
}