DEV Community

Cover image for All the MongoDB Commands that You Need to Know
Kaye Alvarado for Developers @ Asurion

Posted on

All the MongoDB Commands that You Need to Know

Here is a collection of common NoSQL queries and the mongodb commands needed for them:

1. Exact Match

Collection Name: users
Object Field: first_name
Search for: Kaye

db.getCollection('users').find({"first_name":"Kaye"})
Enter fullscreen mode Exit fullscreen mode

2. Like Match

Collection Name: users
Object Field: last_name
Search for: varad

db.getCollection('users').find({"last_name":/varad/})
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, cherished by the supportive DEV Community. Coders of every background are encouraged to bring their perspectives and bolster our collective wisdom.

A sincere “thank you” often brightens someone’s day—share yours in the comments below!

On DEV, the act of sharing knowledge eases our journey and forges stronger community ties. Found value in this? A quick thank-you to the author can make a world of difference.

Okay