This can also be done with $eq
> db.person.insert({name: 'Paul', age: 43, friends: [1234, 2345, 3456]})
> db.person.insert({name: 'Dave', age: 23, friends: [2345, 3456]})
> db.person.insert({name: 'Stephen', age: 12, friends: [2345, 3456, 7890]})
Below is an example using $eq:
> db.person.find({friends: {$eq : 2345}})
{ "_id" : ObjectId("54e34124fe135475834334da"), "name" : "Paul", "age" : 43, "friends" : [ 1234, 2345, 3456 ] }
{ "_id" : ObjectId("54e34138fe135475834334db"), "name" : "Dave", "age" : 23, "friends" : [ 2345, 3456 ] }
{ "_id" : ObjectId("54e3414bfe135475834334dc"), "name" : "Stephen", "age" : 12, "friends" : [ 2345, 3456, 7890 ] }
but the queries below also find the same. So as Sven suggested, you can leave out $eq.
> db.person.find({friends: 2345})
{ "_id" : ObjectId("54e34124fe135475834334da"), "name" : "Paul", "age" : 43, "friends" : [ 1234, 2345, 3456 ] }
{ "_id" : ObjectId("54e34138fe135475834334db"), "name" : "Dave", "age" : 23, "friends" : [ 2345, 3456 ] }
{ "_id" : ObjectId("54e3414bfe135475834334dc"), "name" : "Stephen", "age" : 12, "friends" : [ 2345, 3456, 7890 ] }
> db.person.find({friends: 1234})
{ "_id" : ObjectId("54e34124fe135475834334da"), "name" : "Paul", "age" : 43, "friends" : [ 1234, 2345, 3456 ] }