MongoDB logo
  • Platform
    atlas_product_familyAtlasBuild and scale with an AI-ready platform
    Platform Services
    atlas_databaseDatabaseDeploy a multi-cloud databaseatlas_searchSearchDeliver engaging search experiencesmdb_vector_searchVector SearchDesign intelligent apps with gen AIatlas_stream_processingStream ProcessingIntegrate MongoDB and Kafka
    Self Managed
    enterprise_advanced_product familyEnterprise AdvancedRun and manage MongoDB yourselfcommunity_edition_product_familyCommunity EditionDevelop locally with MongoDB
    Tools
    mdb_compassCompassWork with MongoDB data in a GUIatlas_integrationIntegrationsIntegrations with third-party servicesmdb_migratorRelational MigratorMigrate to MongoDB with confidence
    View All ProductsExplore our full developer suitearrow-right
    MongoDB 8.0Our fastest version everarrow-right
    Build with MongoDB Atlas
    Get started for free in minutes
    Sign Up
    Test Enterprise Advanced
    Develop with MongoDB on-premises
    Download
    Try Community Edition
    Explore the latest version of MongoDB
    Download
  • Documentation
    Atlas DocumentationGet started using AtlasServer DocumentationLearn to use MongoDBStart With GuidesGet step-by-step guidance for key tasks
    Tools and ConnectorsLearn how to connect to MongoDBMongoDB DriversUse drivers and libraries for MongoDB
    Resources HubGet help building the next big thing with MongoDBarrow-right
    Connect
    atlas_product_familyDeveloper CenterExplore a wide range of developer resourcesgeneral_events_ask_the_expertsCommunityJoin a global community of developersgeneral_content_tutorialCourses and CertificationLearn for free from MongoDBgeneral_events_sessionEvents and WebinarsFind an event or webinar near you
  • Use cases
    Artificial IntelligencePaymentsServerless DevelopmentGaming
    Industries
    Financial ServicesTelecommunicationsHealthcareRetailPublic SectorManufacturing
    Solutions LibraryOrganized and tailored solutions to kick-start projectsarrow-right
    AI Applications Program
    Expedite your AI journey with expert guidance
    Learn morearrow-right
    Startups and AI Innovators
    For world-changing ideas and AI pioneers
    Learn morearrow-right
    Customer Case Studies
    Hear directly from our users
    See Storiesarrow-right
  • CareersStart your next adventureBlogRead articles and announcementsNewsroomRead press releases and news stories
    PartnersLearn about our partner ecosystemLeadershipMeet our executive teamCompanyLearn more about who we are
    Contact Us
    Reach out to MongoDB
    Let’s chatarrow-right
    Investors
    Visit our investor portal
    Learn morearrow-right
  • Pricing
SupportSign In
Get Started
MongoDB logo
MongoDB logo
  • Platform
    atlas_product_familyAtlasBuild and scale with an AI-ready platform
    Platform Services
    atlas_databaseDatabaseDeploy a multi-cloud databaseatlas_searchSearchDeliver engaging search experiencesmdb_vector_searchVector SearchDesign intelligent apps with gen AIatlas_stream_processingStream ProcessingIntegrate MongoDB and Kafka
    Self Managed
    enterprise_advanced_product familyEnterprise AdvancedRun and manage MongoDB yourselfcommunity_edition_product_familyCommunity EditionDevelop locally with MongoDB
    Tools
    mdb_compassCompassWork with MongoDB data in a GUIatlas_integrationIntegrationsIntegrations with third-party servicesmdb_migratorRelational MigratorMigrate to MongoDB with confidence
    View All ProductsExplore our full developer suitearrow-right
    MongoDB 8.0Our fastest version everarrow-right
    Build with MongoDB Atlas
    Get started for free in minutes
    Sign Up
    Test Enterprise Advanced
    Develop with MongoDB on-premises
    Download
    Try Community Edition
    Explore the latest version of MongoDB
    Download
  • Documentation
    Atlas DocumentationGet started using AtlasServer DocumentationLearn to use MongoDBStart With GuidesGet step-by-step guidance for key tasks
    Tools and ConnectorsLearn how to connect to MongoDBMongoDB DriversUse drivers and libraries for MongoDB
    Resources HubGet help building the next big thing with MongoDBarrow-right
    Connect
    atlas_product_familyDeveloper CenterExplore a wide range of developer resourcesgeneral_events_ask_the_expertsCommunityJoin a global community of developersgeneral_content_tutorialCourses and CertificationLearn for free from MongoDBgeneral_events_sessionEvents and WebinarsFind an event or webinar near you
  • Use cases
    Artificial IntelligencePaymentsServerless DevelopmentGaming
    Industries
    Financial ServicesTelecommunicationsHealthcareRetailPublic SectorManufacturing
    Solutions LibraryOrganized and tailored solutions to kick-start projectsarrow-right
    AI Applications Program
    Expedite your AI journey with expert guidance
    Learn morearrow-right
    Startups and AI Innovators
    For world-changing ideas and AI pioneers
    Learn morearrow-right
    Customer Case Studies
    Hear directly from our users
    See Storiesarrow-right
  • CareersStart your next adventureBlogRead articles and announcementsNewsroomRead press releases and news stories
    PartnersLearn about our partner ecosystemLeadershipMeet our executive teamCompanyLearn more about who we are
    Contact Us
    Reach out to MongoDB
    Let’s chatarrow-right
    Investors
    Visit our investor portal
    Learn morearrow-right
  • Pricing
SupportSign In
Get Started
MongoDB logo
  • Docs Home

  • PHP Library Manual
  • Get Started
  • Connect to MongoDB
  • Databases & Collections
  • Read Data
  • Write Data
  • Operations with Builders
  • CRUD Operations & Replica Sets
  • Run a Database Command
  • Data Aggregation
  • Indexes
  • Monitor Your Application
  • Security
  • Specialized Data Formats
  • Deploy to AWS Lambda
  • Compatibility
  • What's New
  • Upgrade
  • FAQ
  • API Documentation
  • BSON
  • MongoDB\Client
  • __construct()
  • __get()
  • addSubscriber()
  • bulkWrite()
  • createClientEncryption()
  • dropDatabase()
  • getCollection()
  • getDatabase()
  • getManager()
  • getReadConcern()
  • getReadPreference()
  • getTypeMap()
  • getWriteConcern()
  • listDatabaseNames()
  • listDatabases()
  • removeSubscriber()
  • selectCollection()
  • selectDatabase()
  • startSession()
  • watch()
  • MongoDB\ClientBulkWrite
  • MongoDB\Database
  • MongoDB\Collection
  • MongoDB\GridFS\Bucket
  • Result Classes
  • Functions
  • Exception Classes
    Docs Menu
    Docs Home
    /
    Languages
    /
    PHP
    /
    PHP Library Manual
    /
    API Documentation

    MongoDB\Client Class

    Definition

    MongoDB\Client

    This class serves as an entry point for the MongoDB PHP Library. It is the preferred class for connecting to a MongoDB server or cluster of servers and acts as a gateway for accessing individual databases and collections. MongoDB\Client is analogous to the extension's MongoDB\Driver\Manager class, which it composes.

    Methods

    • MongoDB\Client::__construct()

    • MongoDB\Client::__get()

    • MongoDB\Client::addSubscriber()

    • MongoDB\Client::bulkWrite()

    • MongoDB\Client::createClientEncryption()

    • MongoDB\Client::dropDatabase()

    • MongoDB\Client::getCollection()

    • MongoDB\Client::getDatabase()

    • MongoDB\Client::getManager()

    • MongoDB\Client::getReadConcern()

    • MongoDB\Client::getReadPreference()

    • MongoDB\Client::getTypeMap()

    • MongoDB\Client::getWriteConcern()

    • MongoDB\Client::listDatabaseNames()

    • MongoDB\Client::listDatabases()

    • MongoDB\Client::removeSubscriber()

    • MongoDB\Client::selectCollection()

    • MongoDB\Client::selectDatabase()

    • MongoDB\Client::startSession()

    • MongoDB\Client::watch()

    Back

    BSON

    Next

    __construct()

    On this page

    • Definition
    • Methods

    On this page

    • Definition
    • Methods