I am doing a search in a collection for a document based on its id.
What is returned if find(the_id) can not be found?
session[:remote_ip] = request.env['REMOTE_ADDR'].split(',').first
user = User.find({user_id: session[:remote_ip]})
if user.nil?
# Do stuff if find couldn't find the user_id
# Am I right to assume it will return nil?
Absolutely !
As you can see there is even a spec for it :
https://github.com/jnunemaker/mongomapper/blob/master/test/functional/test_querying.rb#L183
Give a try to Mongoid too.
This is another great gem for MongoDB :
https://github.com/mongoid/mongoid