Skip to content

Instantly share code, notes, and snippets.

View julianYaman's full-sized avatar

Julian Yaman julianYaman

View GitHub Profile
@julianYaman
julianYaman / mongoregex_example.php
Last active January 6, 2017 19:44
MongoRegex - Matching the exact word
// Example: You have following documents with following content
// ['yourstring','yourstring1','1yourstring','23yourstring','your2string']
// You only want the first document with the content "yourstring"
// but you don´t want to care about large and lowercase when somebody tries to find the document.
// Here is the solution:
// Connection to MongoDB
$m = new MongoClient();
// Our search string