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

    Samsung MagicINFO Vulnerability Allows Remote Code Execution Without Valid User

    Security

    Google Pixel Watch 4 vs. Samsung Galaxy Watch 8: I compared the two best Androids, and here’s the winner

    News & Updates

    From Fine-Tuning to Prompt Engineering: Theory and Practice for Efficient Transformer Adaptation

    Machine Learning

    Visual Studio Code now supports Baseline

    Development

    Highlights

    Scaling Amazon RDS for MySQL performance for Careem’s digital platform on AWS

    May 14, 2025

    This is a guest post co-written with Khurram Naseem, Senior Director of Engineering at Careem…

    Email Security Is Stuck in the Antivirus Era: Why It Needs a Modern Approach

    July 28, 2025

    CVE-2025-21756: How a Tiny Linux Kernel Bug Led to a Full Root Exploit, PoC Releases

    April 29, 2025

    How to Build a Conversational AI Chatbot with Stream Chat and React

    June 17, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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