Skip to content

Using 'meteor mongo'

TylerSheffels edited this page Jul 12, 2015 · 2 revisions

Drop code snippets that are helpful during mongo troubleshooting on this page

Replace text in brackets with the actual value, e.g. gets replaced with admin@gmail.com

I want to find a user by email

db.users.find({emails: { $elemMatch: {address: "<email>"} } }).pretty()

I want to set the roles for a certain user

db.users.update({emails: { $elemMatch: {address: "joseyrenaud@hotmail.com"} } }, {$set: {roles: ["user"]}})

I want to find everyone in a given role

db.users.find({roles: "user"}, {emails: true} ).pretty()

Clone this wiki locally