Skip to content

Convert a MongoDB code with MongoDB\Driver\Manager #758

@Pim92

Description

@Pim92

Hello,

Web development beginner, I'm trying to convert a code to access MongoDB using MongoDB\Driver\Manager, but have some difficulties. Indeed, this new driver seems to me a little bit low-level compared to the previous one so it can be a bit complicated to work with...

$mongoConn = new MongoClient("mongodb://localhost:27017");
$mongoDB = $mongoConn->selectDataBase(dbname1);//dbname2 exists too
...
$index = new MongoDBIndexation($mongoDB);//our class for using

If it is ok that I must begin with:

$mongoConn = new MongoDB\Driver\Manager("mongodb://localhost:27017");

How to continue with $mongoDB, please?

And what are the equivalents of:

$collection->remove
$collection->save and
$collection->findOne ?

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions