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)