MongoDB $log10 Operator Last Updated : 15 Jul, 2025 Comments Improve Suggest changes Like Article Like Report In MongoDB, the $log10 operator is a powerful tool that allows users to perform mathematical computations directly within the database. This operator returns the base 10 logarithm of a specified number and making it invaluable for data analysis and transformation tasks. In this article, We will learn about the MongoDB $log10 Operator by understanding various examples in detail and so on.MongoDB $log10 OperatorMongoDB $log10 operator returns the base 10 logarithms of a specified number. It can be used within aggregation expressions to perform mathematical operations on document numerical values. This operator is used to find the log base 10 of the specified number and returns the result as a double.Syntax: { $log10: <number> }Here, the number is a valid expression until it resolves to a non-negative number. If the entered value is null, then this operator will return null.If the entered value is NaN, then this operator will return NaN.If the entered value is a missing field, then this operator will return null.Examples of MongoDB $log10 Operator In the following examples, we are working with:Database: GeeksforGeeksCollection: exampleDocument: two documents that contain the details of the shapes in the form of field-value pairs.Output:Example 1: Using $log10 OperatorIn this example, we are going to find the log base 10 of the value of the side field in the square document.db.example.aggregate([{$match:{name: "Square"}},... {$project: {logbas10: {$log10: "$side"}}}])Output:Example 2: Using $log10 operator in the embedded documentIn this example, we are going to find the log base 10 of the value of the measurement.height field in the rectangle document. db.example.aggregate([{$match:{name: "Rectangle"}},... {$project: {logbase10: {$log10: "$measurement.height"}}}])Output: ConclusionThe $log10 operator in MongoDB simplifies the process of performing logarithmic calculations within the database, enhancing the efficiency and effectiveness of data analysis tasks. By using this operator, users can perform complex mathematical transformations directly in their MongoDB queries, reducing the need for additional data processing steps outside the database. Create Quiz Comment A ankita_saini Follow 0 Improve A ankita_saini Follow 0 Improve Article Tags : MongoDB Databases MongoDB-operators Explore IntroductionHow do Document Databases Work?6 min readHow MongoDB works ?4 min readMongoDB Introduction3 min readMongoDB: Getting Started5 min readMongoDB - Working and Features6 min readDifference between RDBMS and MongoDB5 min readMongoDB vs MySQL5 min readInstallationHow to Install and Configure MongoDB in Ubuntu?5 min readHow to Install MongoDB on MacOS6 min readHow to Install MongoDB on Windows?5 min readBasics of MongoDBMongoDB - Database, Collection, and Document6 min readMongoDB Cursor9 min readDataTypes in MongoDB8 min readWhat is ObjectId in MongoDB5 min readWhat is a MongoDB Query?10 min readMongoDB - Create Database using Mongo Shell4 min readMongoDB | Delete Database using MongoShell4 min readMongoDB CRUD Operations3 min readMongoDB MethodsMongoDB - Insert() Method6 min readMongoDB insertOne() Method - db.Collection.insertOne()3 min readMongoDB insertMany() Method - db.Collection.insertMany()6 min readMongoDB - Bulk.insert() Method2 min readMongoDB - bulkWrite() Method8 min readMongoDB - Update() Method7 min readMongoDB - updateOne() Method4 min readMongoDB updateMany() Method - db.Collection.updateMany()4 min readMongoDB - Find() Method3 min readMongoDB - FindAndModify() Method6 min readMongoDB - FindOne() Method3 min readMongoDB - findOneAndDelete() Method6 min readMongoDB - db.collection.findOneAndReplace() Method6 min readMongoDB - db.collection.findOneAndUpdate() Method5 min readMongoDB - sort() Method5 min readMongoDB - copyTo() Method3 min readMongoDB Count() Method - db.Collection.count()5 min readMongoDB - countDocuments() Method5 min readMongoDB - Drop Collection4 min readMongoDB Remove() Method - db.Collection.remove()5 min readMongoDB - db.collection.deleteone()2 min readMongoDB - Distinct() Method3 min readMongoDB - limit() Method4 min readMongoDB - skip() Method4 min readMongoDB | ObjectID() Function2 min readMongoDB - db.collection.CreateIndex() Method7 min readcreateIndexes() Method in MongoDB5 min readMongoDB - getIndexes() Method4 min readMongoDB dropIndex() Method5 min readMongoDB - dropIndexes() Method3 min readComparison OperatorsMongoDB - Comparison Query Operators2 min readMongoDB $cmp Operator4 min readMongoDB $gt Operator4 min readMongoDB - $lt Operator4 min readMongoDB - $eq Operator4 min readMongoDB - $lte Operator2 min readMongoDB - $gte Operator2 min readMongoDB - $ne Operator2 min readMongoDB $in Operator4 min readMongoDB - $nin Operator2 min readLogical OperatorsMongoDB - Logical Query Operators3 min readMongoDB AND operator ( $and )4 min readMongoDB OR operator ( $or )6 min readMongoDB NOT operator ( $not )5 min readMongoDB NOR Operator ( $nor )4 min readArithmetic OperatorsMongoDB $add Operator4 min readMongoDB $subtract Operator4 min readMongoDB $multiply Operator4 min readMongoDB $divide Operator4 min readMongoDB $abs operator4 min readMongoDB $floor Operator4 min readMongoDB $ceil Operator3 min readMongoDB $mod Operator1 min readMongoDB $sqrt Operator2 min readMongoDB $pow Operator4 min readMongoDB $exp Operator3 min readMongoDB $log Operator3 min readMongoDB $log10 Operator3 min readMongoDB $ln Operator5 min readField Update OperatorsMongoDB - Field Update Operators5 min readMongoDB - $max Operator4 min readMongoDB - $min Operator5 min readMongoDB - $inc Operator5 min readMongoDB - $mul Operator5 min readMongoDB - Rename Operator ($rename)5 min readMongoDB - Current Date Operator ($currentDate)2 min readMongoDB - $setOnInsert Operator4 min readMongoDB Bitwise Update Operator3 min readArray Expression OperatorsMongoDB - $isArray Operator6 min readMongoDB $size Operator5 min readMongoDB $arrayElemAt Operator5 min readMongoDB $concatArrays Operator4 min readMongoDB $reverseArray Operator5 min readArray Update OperatorsMongoDB $pull Operator5 min readMongoDB - $pop Operator4 min readMongoDB - $pullAll Operator3 min readMongoDB $push Operator5 min readMongoDB - Positional Operator ($)4 min readMongoDB All Positional Operator ($[])4 min readMongoDB - $position Modifier4 min readMongoDB $addToSet Operator3 min readMongoDB - $each Modifier3 min readMongoDB - $sort Modifier4 min readMongoDB - $slice Modifier4 min read Like