Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7555893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:43:52+00:00 2026-05-30T11:43:52+00:00

No idea why this is not working. It’s the first time I am working

  • 0

No idea why this is not working. It’s the first time I am working with Mongo, but from all the docs I have read, this should work? Anyone have any idea what I am missing?

require 'rubygems'                                                                                                                                                                                      
require 'sinatra/base' 
require 'mongo_mapper'                                                                                                                                                                                  

  mongo_server = '127.0.0.1'                                                                                                                                                       
  mongo_database = 'inone'                                                                                                                                                         

  MongoMapper.connection = Mongo::Connection.new(mongo_server)                                                                                                                                            
  MongoMapper.database = mongo_database                                                                                                                                                                   

  # DB model                                                                                                                                                                                              
  class URLstore                                                                                                                                                                                          
    include MongoMapper::Document                                                                                                                                                                         

    key :url_key, String                                                                                                                                                                                  
    key :url, String                                                                                                                                                                                      
  end                      

class URLnip < Sinatra::Base                                                                                                                                                                            
   get '/testmongo' do         
    nipurl = URLstore.new(:url_key => "abc", :url => "www.google.com")                                                                                                                                                                                                                                                                                                           
    nipurl.save  
  end
end

Opening the Mongo terminal I can see the DB get’s created

> show dbs
inone   0.203125GB

but doing this brings back no results at all

> db.inone.find()
> 

or

> db.inone.find({url : 'www.google.com'})
> 

same thing nothing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T11:43:53+00:00Added an answer on May 30, 2026 at 11:43 am

    Shouldn’t that be db.urlstore.find()? Or however MongoMapper changes the case. What does show collections in a Mongo shell say after you select the right database?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some basic idea on how to do this task, but I'm not
I have this code to restart a service, but this is not working. I
I have no idea why this isn't working. I've taken code from a previous
Any idea why this is not working: $result = mysql_query(SELECT cust_name, description from `projects`
I have absolutely no idea why this is not working. Makes no sense to
does anyone have any idea why this function is not working in Jquery? $('.left').show(slide,
I'm not 100% convinced that this is a good idea, but I bumped into
Please not that I fully understand this is a dumb ass idea, but its
Why this is not working? link_to_function share, slide-build(#{@idea.id.to_s}), :class => share in my application.js
Anyone got any Idea why this code is not working, It was working fine

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.