Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

323
Visualizações
Fatal error: Class 'MongoClient' not found?

I have used MongoDB3.0 with PHP version 5.3.5 and PHP Driver version 1.1.4. i have tried to insert record to collection i got Fatal error class Mongo client Not fount

insert.php

<?php   
       // connect to mongodb
   $m = new MongoClient("mongodb://localhost:27017");
   echo "Connection to database successfully";

   // select a database
   $db = $m->sample;
   echo "Database mydb selected";
   $collection = $db->testcoll;
   echo "Collection selected succsessfully";

   $document = array( 
      "title" => "MongoDB", 
      "description" => "database", 
      "likes" => 100,
      "url" => "http://www.tutorialspoint.com/mongodb/",
      "by", "tutorials point"
   );

   $collection->insert($document);
   echo "Document inserted successfully";


?> 

I have also attached PHP driver info enter image description here

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

It is because this class was removed try using http://php.net/manual/en/class.mongodb-driver-manager.php

instead like this:

$manager = new MongoDB\Driver\Manager("mongodb://localhost:2701");

Also mongo extension is not mongodb extension maybe you don't have MongoDB extension installed. Check this link for more details

over 4 years ago · Santiago Trujillo Relatório

0

Since 1.0.0 release you should use MongoDB\Driver\Manage

Most significantly, the legacy driver's MongoClient, MongoDB, and MongoCollection classes have been obsoleted by the MongoDB\Driver\Manager class, which is the new gateway for connecting and executing queries, commands, and write operations.

Source: https://github.com/mongodb/mongo-php-driver/releases/tag/1.0.0

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda