How do I search for a string inside a field in MongoDB? In SQL if i want to search name column for a string pizza
SELECT * FROM restaurants WHERE name LIKE '%pizza%';
What is the equivalent of this in MongoDB?
For a case-insensitive search,
db.restaurants.find( { name: /pizza/i } )
MongoDB equivalent would be
db.restaurants.find({"name": /pizza/})
db.restaurants.find( { name: /pizza/ } )