Theo
Posted on September 1, 2021
A quick snippet for anyone looking for equivalent SQL LIKE queries for mongodb.
db.users.find({name: /a/})
SELECT * FROM USERS WHERE name LIKE '%a%';
db.users.find({name: /^ja/})
SELECT * FROM USERS WHERE name LIKE 'ja%'
db.users.find({name: /jo$/})
SELECT * FROM USERS WHERE name LIKE '%jo'
💖 💪 🙅 🚩
Theo
Posted on September 1, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.