Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Error’d: Pickup Sticklers

      September 27, 2025

      From Prompt To Partner: Designing Your Custom AI Assistant

      September 27, 2025

      Microsoft unveils reimagined Marketplace for cloud solutions, AI apps, and more

      September 27, 2025

      Design Dialects: Breaking the Rules, Not the System

      September 27, 2025

      Building personal apps with open source and AI

      September 12, 2025

      What Can We Actually Do With corner-shape?

      September 12, 2025

      Craft, Clarity, and Care: The Story and Work of Mengchu Yao

      September 12, 2025

      Cailabs secures €57M to accelerate growth and industrial scale-up

      September 12, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Using phpinfo() to Debug Common and Not-so-Common PHP Errors and Warnings

      September 28, 2025
      Recent

      Using phpinfo() to Debug Common and Not-so-Common PHP Errors and Warnings

      September 28, 2025

      Mastering PHP File Uploads: A Guide to php.ini Settings and Code Examples

      September 28, 2025

      The first browser with JavaScript landed 30 years ago

      September 27, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured
      Recent
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»MongoDB Data Types

    MongoDB Data Types

    August 23, 2025

    Below are the main data types in MongoDB:

    • String (“text”)
    • Integer (int32, int64)
    • Double (double)
    • Boolean (true/false)
    • Null
    • Arrays
    • Object / Embedded Document
    • ObjectId
    • Date
    • Regular Expression (regex)
    • Binary Data
    • Timestamp

    String (“text”)

    • Most common data type.
    • Stores text values in UTF-8 format.
    { "name": "Anuj Kumar" }

    Integer (int32, int64)

    • Stores numeric values.
    • int32: For smaller numbers (−2,147,483,648 to 2,147,483,647).
    • int64: For larger numbers.
    { "age": 25 }

    Double (double)

    • Stores floating-point numbers.
    { "price": 249.48 }

    Boolean (true/false)

    • Stores true/false values.
    { "isMarried": true }

    Null

    • Represents a null or missing value.
    { "middleName": null }

    Arrays

    • Stores multiple values in a single field.
    { "skills": ["PHP", "Python", "MongoDB"] }

    Object / Embedded Document

    • Stores a document inside another document.
    { 
      "address": { "city": "Delhi", "pin": 110001 } 
    }

    ObjectId

    • A unique 12-byte ID is automatically generated for each document in a collection.
    { "_id": ObjectId("507f1f77bcf86cd799439011") }

    Date

    • Stores the current date/time in UTC format.
    { "createdAt": new Date(),
      "dob" : ISODate("2002-05-01T12:30:00Z")
    
    }

    Regular Expression (regex)

    • Stores regex patterns for advanced queries.
    { "name": { "$regex": "^A" } }

    Binary Data

    • Stores binary data (e.g., images, files).
    { "file": BinData(0,"YW55IGNhcm5hbCBwbGVhc3VyZQ==") }

    Timestamp

    • Records a timestamp, often used internally by MongoDB for replication.
    { "lastUpdatedDate": Timestamp() }

    The post MongoDB Data Types appeared first on PHPGurukul.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleBlue Locker ransomware hits critical infrastructure – is your organisation ready?
    Next Article Redux without React — State Management in Vanilla JavaScript

    Related Posts

    Development

    Using phpinfo() to Debug Common and Not-so-Common PHP Errors and Warnings

    September 28, 2025
    Development

    Mastering PHP File Uploads: A Guide to php.ini Settings and Code Examples

    September 28, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    Google’s New AI Mode Could Replace How You Search, Shop, and Travel Forever

    Artificial Intelligence

    Denodo Scheduler Vulnerability Let Attackers Execute Remote Code

    Security

    HCL Commerce V9.1 – Coexistence of the Headless Next.js Ruby & Aurora Storefronts

    Development

    Build Beauty Test AI product and Design UI

    Web Development

    Highlights

    Development

    My Experience at the Salesforce Nagpur Ohana Gathering – June 2025

    July 16, 2025

    Hello Trailblazers! Last week, I had the amazing opportunity to attend the “Salesforce Nagpur Ohana Gathering…

    Designing for Print in Canva: Mistakes to Avoid

    July 15, 2025

    Generating audio for video

    May 13, 2025

    New Malware Loaders Use Call Stack Spoofing, GitHub C2, and .NET Reactor for Stealth

    April 2, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.