Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

318
Views
Error fatal: ¿No se encontró la clase 'MongoClient'?

He usado MongoDB3.0 con PHP versión 5.3.5 y PHP Driver versión 1.1.4. Intenté insertar un registro en la colección. Obtuve un error fatal. Clase de cliente Mongo No fuente

insertar.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"; ?>

También he adjuntado información del controlador de PHP ingrese la descripción de la imagen aquí

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Es porque esta clase se eliminó, intente usar http://php.net/manual/en/class.mongodb-driver-manager.php

en cambio así:

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

Además, la extensión mongo no es la extensión mongodb, tal vez no tenga instalada la extensión MongoDB. Revisa este enlace para más detalles

over 4 years ago · Santiago Trujillo Report

0

Desde la versión 1.0.0, debe usar MongoDB\Driver\Manage

Lo más significativo es que las clases MongoClient, MongoDB y MongoCollection del controlador heredado han quedado obsoletas por la clase MongoDB\Driver\Manager, que es la nueva puerta de enlace para conectar y ejecutar consultas, comandos y operaciones de escritura.

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

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!