{"id":30738920,"url":"https://github.com/muhammadfarooq85/mongodb-arthematic-operators","last_synced_at":"2025-10-26T12:12:35.889Z","repository":{"id":262938974,"uuid":"886196627","full_name":"muhammadfarooq85/MongoDb-Arthematic-Operators","owner":"muhammadfarooq85","description":"This repository is about how to use Arthematic operators in mongoDb.","archived":false,"fork":false,"pushed_at":"2024-11-15T05:26:26.000Z","size":1,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-15T13:37:16.740Z","etag":null,"topics":["database","mongodb","mongoose","nosql"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/muhammadfarooq85.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-10T13:08:57.000Z","updated_at":"2024-11-15T05:28:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"53fde0e6-7f97-4a03-af8a-5b6d8251b373","html_url":"https://github.com/muhammadfarooq85/MongoDb-Arthematic-Operators","commit_stats":null,"previous_names":["farooq85-dev/mongodb-arthimatic-operators","muhammadfarooq85/mongodb-arthematic-operators"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/muhammadfarooq85/MongoDb-Arthematic-Operators","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammadfarooq85%2FMongoDb-Arthematic-Operators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammadfarooq85%2FMongoDb-Arthematic-Operators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammadfarooq85%2FMongoDb-Arthematic-Operators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammadfarooq85%2FMongoDb-Arthematic-Operators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muhammadfarooq85","download_url":"https://codeload.github.com/muhammadfarooq85/MongoDb-Arthematic-Operators/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammadfarooq85%2FMongoDb-Arthematic-Operators/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273523637,"owners_count":25120864,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","mongodb","mongoose","nosql"],"created_at":"2025-09-03T22:41:10.165Z","updated_at":"2025-10-26T12:12:35.570Z","avatar_url":"https://github.com/muhammadfarooq85.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# MongoDb-Arthimatic-Operators\n\n### What are Arthimatic operators in MongoDB?\n\n#### In MongoDB, arithmetic operators are used to perform mathematical operations on data within aggregation pipelines.\n\n### 1) `add`\n\n#### Adds numbers or concatenates strings.\n\n```\ndb.collection.aggregate([\n  {\n    $project: {\n      newPrice: {\n        $add: [\"$price\", 100]\n      }\n    }\n  }\n])\n```\n\n### 2) `substract`\n\n#### Subtracts one number from another.\n\n```\ndb.collection.aggregate([\n  {\n    $project: {\n      newPrice: {\n        $subtract: [\"$price\", 2]\n      }\n    }\n  }\n])\n```\n\n### 3) `substract`\n\n#### Subtracts one number from another.\n\n```\ndb.collection.aggregate([\n  {\n    $project: {\n      newPrice: {\n        $subtract: [\"$price\", 2]\n      }\n    }\n  }\n])\n```\n\n### 4) `multiply`\n\n#### Multiplies numbers together.\n\n```\ndb.collection.aggregate([\n  {\n    $project: {\n      newPrice: {\n        $multiply: [\"$price\", 2]\n      }\n    }\n  }\n])\n```\n\n### 5) `mod`\n\n#### Returns the remainder of a division operation.\n\n```\ndb.collection.aggregate([\n  {\n    $project: {\n      newPrice: {\n        $mod: [\"$price\", 2]\n      }\n    }\n  }\n])\n```\n\n### 6) `abs`\n\n#### Returns the absolute value of a number (ignores negative signs).\n\n```\ndb.collection.aggregate([\n  {\n    $project: {\n      newPrice: {\n        $abs: [\"$price\"]\n      }\n    }\n  }\n])\n```\n\n### 7) `ceil`\n\n#### Rounds a number up to the nearest integer.\n\n```\ndb.collection.aggregate([\n  {\n    $project: {\n      newPrice: {\n        $ceil: [\"$price\"]\n      }\n    }\n  }\n])\n```\n\n### 8) `floor`\n\n#### Rounds a number up to the nearest integer.\n\n```\ndb.collection.aggregate([\n  {\n    $project: {\n      newPrice: {\n        $floor:[\"$price\"]\n      }\n    }\n  }\n])\n```\n\n### 9) `round`\n\n#### Rounds a number to a specified decimal place.\n\n```\ndb.collection.aggregate([\n  {\n    $project: {\n      newPrice: {\n        $round:[\"$price\"]\n      }\n    }\n  }\n])\n```\n\n### 10) `sqrt`\n\n#### Returns the square root of a number.\n\n```\ndb.collection.aggregate([\n  {\n    $project: {\n      newPrice: {\n        $sqrt:[\"$price\"]\n      }\n    }\n  }\n])\n```\n\n### 11) `pow`\n\n#### Raises a number to a specified exponent (base^exponent).\n\n```\ndb.collection.aggregate([\n  {\n    $project: {\n      newPrice: {\n        $pow:[ \"$base\", 2 ] // Square the value of base\n      }\n    }\n  }\n])\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuhammadfarooq85%2Fmongodb-arthematic-operators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuhammadfarooq85%2Fmongodb-arthematic-operators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuhammadfarooq85%2Fmongodb-arthematic-operators/lists"}