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

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay