Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
i wan't search article_id LIKE '34%'
I use:
$cursor = $collection->find(array('article_id' => new MongoRegex("/^34/")));
But, return FALSE
Help me
MongoDB's regex only works on strings. So if you need this capability but also want the ability to do Number like queries such as $gt, then you need to duplicate your field and have it stored once as a Number and once as a String.
Add a comment
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.