I need to insert some data using mongoose but the name of the collection is provided by the user at the moment of the insertion, so I first have to check if the collection e
Find collection in collection's list
public function CollectionExists($collectionName) { $mongo = new Mongo(); $collectionArr = $mongo->selectDB('yourrec')->listCollections(); if (in_array($collectionName, $collectionArr)) { return true; } return false; }