PHP & MongoDB – Drop Collection First step to do any operation is to create a Manager instance. // Connect to MongoDB using Manager Instance $manager = new MongoDBDriverManager(“mongodb://localhost:27017”); Second step is to prepare and execute a command to drop the collection. // Create a Command Instance $createCollection = new MongoDBDriverCommand([“drop” => “sampleCollection”]); // Execute […]
Category Archives: php Mongodb
PHP & MongoDB – Create Collection First step to do any operation is to create a Manager instance. // Connect to MongoDB using Manager Instance $manager = new MongoDBDriverManager(“mongodb://localhost:27017”); Second step is to prepare and execute a command to create the collection. // Create a Command Instance $createCollection = new MongoDBDriverCommand([“create” => “sampleCollection”]); // Execute […]
PHP & MongoDB – Drop Database First step to do any operation is to create a Manager instance. // Connect to MongoDB using Manager Instance $manager = new MongoDBDriverManager(“mongodb://localhost:27017”); Second step is to prepare and execute a command to drop the database. // Create a Command Instance $dropDatabase = new MongoDBDriverCommand([“dropDatabase” => 1]); // Execute […]