PHP & MongoDB – Error Handling MongoDB driver operations throws exceptions in case of any database operations and can be captured easily using following syntax: try { } catch (MongoDBDriverExceptionException $e) { echo “Exception:”, $e->getMessage(), “<br/>”; echo “File:”, $e->getFile(), “<br/>”; echo “Line:”, $e->getLine(), “<br/>”; } Example Try the following example to check database operation error […]
Author Archives: user
PHP & MongoDB – Useful Resources The following resources contain additional information on PHP and MongoDB. Please use them to get more in-depth knowledge on this topic. Useful Links on PHP and MongoDB − MongoDB”s official website for its latest docs and updates. − Wikipedia Reference for MongoDB. − Class documentation and examples Useful Books […]
PHP & MongoDB – Sorting Records 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 Query object to select record(s) in the collection and pass it filters and options to sort the records. […]