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 4029056
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:17:51+00:00 2026-05-20T11:17:51+00:00

For example, I would like to create a new ‘Tweet’ object from the following

  • 0

For example, I would like to create a new ‘Tweet’ object from the following JSON

{:for_user=>14248719, :message=>{:place=>nil, :user=>{:contributors_enabled=>false, :statuses_count=>217, :profile_use_background_image=>true, :friends_count=>3, :profile_background_color=>"C0DEED", :url=>nil, :following=>nil, :verified=>false, :profile_background_image_url=>"http://a3.twimg.com/a/1298748610/images/themes/theme1/bg.png", :time_zone=>nil, :favourites_count=>0, :profile_text_color=>"333333", :follow_request_sent=>nil, :profile_sidebar_fill_color=>"DDEEF6", :description=>"Lets get panda dev team rawk!", :id_str=>"95923128", :profile_background_tile=>false, :followers_count=>2, :created_at=>"Thu Dec 10 15:29:56 +0000 2009", :protected=>true, :profile_image_url=>"http://a2.twimg.com/profile_images/1121266473/panda01_normal.jpg", :is_translator=>false, :show_all_inline_media=>false, :geo_enabled=>false, :profile_link_color=>"0084B4", :location=>"Brighton", :name=>"letsgetpandadev", :listed_count=>0, :notifications=>nil, :profile_sidebar_border_color=>"C0DEED", :screen_name=>"letsgetpandadev", :id=>95923128, :lang=>"en", :utc_offset=>nil}, :favorited=>false, :coordinates=>nil, :text=>"another magic tweet", :in_reply_to_screen_name=>nil, :in_reply_to_user_id=>nil, :in_reply_to_status_id=>nil, :in_reply_to_status_id_str=>nil, :source=>"web", :contributors=>nil, :retweeted=>false, :in_reply_to_user_id_str=>nil, :id_str=>"44709765150015488", :retweet_count=>0, :created_at=>"Mon Mar 07 10:43:33 +0000 2011", :geo=>nil, :id=>44709765150015488, :entities=>{:urls=>[], :user_mentions=>[], :hashtags=>[]}, :truncated=>false}}

..and have ‘message’, ‘message.user’ etc saved as embedded child models.
Parsing the JSON and inserting that just yields a ‘Tweet’ object with a hash saved in the message property.

Is what I am trying to achieve possible? If so, how? and if not, would it be possible through another method?

I am using Rails 3 and the Mongoid gem for MongoDB.

Thanks

  • 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-20T11:17:51+00:00Added an answer on May 20, 2026 at 11:17 am

    Sure you can — just not with the mongoid/mongomapper wrappers. Connect via the ruby driver itself… This tutorial has more: http://api.mongodb.org/ruby/current/file.TUTORIAL.html

    require 'rubygems'
    require 'mongo'
    
    db = Mongo::Connection.new.db("mydb")
    test_collection = db.collection("testCollection")
    
    doc = {"name" => "MongoDB", "type" => "database", "count" => 1,
           "info" => {"x" => 203, "y" => 102}
          }
    test_collection.insert(doc)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to create a new item collection with modified metadata. For example,
I would like to redirect the following as an example: A.olddomain.com.au/blah.html > A.newdomain.com/blah.html B.olddomain.com.au/blah.html
For the following example: http://developer.yahoo.com/yui/examples/tabview/frommarkup_clean.html I would like to make the tabs right aligned
I would like to create a new kind of project type for Visual Studio
Referring to Menu / Scrolling Example I would like to create / find the
I would like to know many minutes between 2 dates? Example : Now -
In my admin view I would like several sub directories for example: admin/users/list.aspx I
So here's what I'd like to do: access to http://example.com/ * would require the
Say I have a site on http://example.com . I would really like allowing bots
For example, if I make a query like between(1,4,X)? I would expect something like

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.