Tags

, , , ,

=> I am using mongoDB around 1 year with Ruby on Rails., also wrote blog for mongoDB(Sharding, Replication, Admin, Backup& Restore, Operators, CRUD, etc..) on my Blog.
=> Also i would like to Thank 10gen for  providing huge support to learn mongoDB with  presentations, Videos and communicating with Engineers.
=> Here i made simple Food loving application with Rails & mongoDB using ORM(mongoId). There is no GUI or UI i am handling all the process via rails console, and also include some snap shot from rails server’s logs.    

Create Rails Application with mongoID
gurjar_mehul@ubuntu:~/work  rails new Lovefood
gurjar_mehul@ubuntu:~/work/Lovefood$ ls
app     config.ru  doc       Gemfile      log     Rakefile  script  tmp
config  db    Gemfile.lock  lib        public  README       vendor
Define MongoId gem and related other gem for we need for application
  gem ‘rails’, ‘3.1.1’
  gem “mongoid”, “~> 2.4”
  gem “bson_ext”, “~> 1.5”
  gem “mongoid_rails_migrations”
  gem “mongoid_slug”
  gem “mongoid_search”
  gem “mongoid_taggable”
  gem “mongoid-random”
  gem “devise”
  gem “cancan”
 rest of othe for Jquery, saas, Haml, etc..
then Bundle install
Define Database name in config/mongoid.yml
   development:
     host: localhost
     database: foodlove_development
   test:
     host: localhost
     database: foodlove_test

Flow OF Application  (Associations & Attributes)

Diagram

User Model

 

Let’s Start with User Model
=>  rails g model  Entity
=> rails g model User
=> show the Entity & User Class
Create Seed file for User.
=> vi db/seeds.rb
 
 User.delete_all
 
   puts ‘CREATE FIRST USER’
 User.create!(email: “mehul@gmail.com”, password: “123456”, username: “mehul”,             password_confirmation: “123456”, facebook_id: 775417639,profile_image: open(“http://graph.facebook.com/775417639/picture”).read)
  puts ‘SUCCESS’
 
  puts ‘CREATE SECOND USER’
 User.create!(email: “rohit@gmail.com”, password: “123456”, username: “rohit”,password_confirmation: “123456”, facebook_id: 1235013640,profile_image: open(“http://graph.facebook.com/1235013640/picture”).read)
  puts ‘SUCCESS’
 
  puts ‘CREATE THIRD USER’
  User.create!(email: “pintu@gmail.com”, password: “123456”, username: “pintu”,            password_confirmation: “123456”, facebook_id: 558439479, profile_image: open(“http://graph.facebook.com/558439479/picture”).read)
  puts ‘SUCCESS’
 
  puts ‘CREATE FOURTH USER’
  User.create!(email: “piyush@gmail.com”, password: “123456”, username: “piyush”,               password_confirmation: “123456”, facebook_id: 100000378619378, profile_image: open(“http://graph.facebook.com/100000378619378/picture”).read)
  puts ‘SUCCESS’
user1 = User.first
 => #<User _id: 506e57e6a21a9c101d000001, _type: “User”, created_at: 2012-10-05 03:45:48 UTC, updated_at: 2012-10-05 03:45:48 UTC, username: “mehul”, profile_image_uid: “506e57eca21a9c101d00006”, slug: “mehul”, email: “mehul@gmail.com”, encrypted_password: “$2a$10$jmlYA9IyVnBgtFF.MSOE1u5TADBFUYP2FbVqvGhDaKJQXddCHhXki”, reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, authentication_token: “nrPUzHgYr9L6KUYW5xxH”, facebook_id: 775417639, role: 1, about: nil, website: nil, devise_token: nil, auto_publish_facebook: true,country: nil, active: true, >

user1 = User.last

 => #<User _id: 506e57eca21a9c101d000010, _type: “User”, created_at: 2012-10-05 03:45:48 UTC, updated_at: 2012-10-05 03:45:48 UTC, username: “piyush”, profile_image_uid: “506e57eca21a9c101d000011”, slug: “piyush”, email: “piyush@gmail.com”, encrypted_password: “$2a$10$jmlYA9IyVnBgtFF.MSOE1u5TADBFUYP2FbVqvGhDaKJQXddCHhXki”, reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, authentication_token: “nrPUzHgYr9L6KUYW5xxH”, facebook_id: 100000378619378, role: 1, about: nil, website: nil, devise_token: nil, auto_publish_facebook: true,country: nil, active: true, >
user2 = User.where(username: “rohit”).first
#<User _id: 506e57eba21a9c101d000006, _type: “User”, created_at: 2012-10-05 03:45:47 UTC, updated_at: 2012-10-05 03:45:47 UTC, username: “rohit”, profile_image_uid: “506e57eba21a9c101d000007”, slug: “rohit”, email: “rohit@gmail.com”, encrypted_password: “$2a$10$rLlyuq4iX9gGVnd3v4SkleTJeA1aS715NfyhbHD1G28wrTEqes6Ta”, reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, authentication_token: “8pWiLwKDfo1zShygdXcP”, facebook_id: 1235013640, token: nil, role: 1, about: nil, website: nil, devise_token: nil, auto_publish_facebook: true, country: nil, active: true, >

Rails server’s Log when user Signed  IN

Started POST “/login” for 127.0.0.1 at 2012-10-05 11:48:32 +0530
  Processing by Users::SessionsController#create as HTML
  Parameters: {“utf8″=>”✓”, “authenticity_token”=>”I6HcdE56eyYLWLv6LihPjG+Fbhtdk0Xj1Tn/uASMTHU=”, “user”=>{“email”=>”mehul@gmail.com”, “password”=>”[FILTERED]”, “token”=>””, “facebook_id”=>””}, “commit”=>”Login”}
MONGODB (1ms) foodlove_development[‘system.namespaces’].find({})
MONGODB (0ms) foodlove_development[‘entities’].find({:email=>”mehul@gmail.com”, :_type=>{“$in”=>[“User”]}}).limit(-1).sort([[:_id, :asc]])
MONGODB (6ms) foodlove_development[‘entities’].update({“_id”=>”mehul@gmail.com”}, {“$set”=>{“last_sign_in_at”=>2012-10-05 06:18:33 UTC, “current_sign_in_at”=>2012-10-05 06:18:33 UTC, “last_sign_in_ip”=>”127.0.0.1”, “current_sign_in_ip”=>”127.0.0.1”, “sign_in_count”=>1, “updated_at”=>2012-10-05 06:18:33 UTC}})
Redirected to http://localhost:3000
Note =>  Creating Post , First we need to create & retrieve (Picture, Foods, Albums, Locations, tagged user list, etc.)

Picture 

picture.rb
First I would like browse picture for Upload there (example food image)
pic = Picture.last
 => #<Picture _id: 50522acaa21a9c0f11000012, _type: nil, file_uid: “50522acaa21a9c0f11000013”, file_id: nil, user_id: BSON::ObjectId(‘506e57e6a21a9c101d000001’)>

Food

food.rb
food1 = Food.new(name: “Gujarati-foods”)
 => #<Food _id: 506e6580a21a9c103e00000e, _type: “Food”, created_at: nil, updated_at: nil, name: “Gujarati-foods”, description: nil>
1.9.3-p194-perf :083 > food2 = Food.new(name: “South-Indian”)
 => #<Food _id: 506e6592a21a9c103e00000f, _type: “Food”, created_at: nil, updated_at: nil, name: “South-Indian”, description: nil>
1.9.3-p194-perf :084 > food3 = Food.new(name: “Punjabi-food”)
 => #<Food _id: 506e65a6a21a9c103e000010, _type: “Food”, created_at: nil, updated_at: nil, name: “Punjabi-food”, description: nil>

Location 

Location.rb
location = Location.new(name: “Pune”)
 => #<Location _id: 506e660ea21a9c103e000011, _type: nil, created_at: nil, updated_at: nil, name: “Pune”>

Album

Album.rb
album1 = Album.new(name: “Album1”, user_id: user.id)
 => #<Album _id: 506e6985a21a9c103e000014, _type: nil, created_at: nil, updated_at: nil, name: “Album1”, user_id: BSON::ObjectId(‘506e57e6a21a9c101d000001’), post_ids: []>
1.9.3-p194-perf :136 > album2 = Album.new(name: “Album2”, user_id: user.id)
 => #<Album _id: 506e69a3a21a9c103e000015, _type: nil, created_at: nil, updated_at: nil, name: “Album2”, user_id: BSON::ObjectId(‘506e57e6a21a9c101d000001’), post_ids: []>
1.9.3-p194-perf :137 > album3 = Album.new(name: “Album3”, user_id: user.id)
 => #<Album _id: 506e69bca21a9c103e000016, _type: nil, created_at: nil, updated_at: nil, name: “Album3”, user_id: BSON::ObjectId(‘506e57e6a21a9c101d000001’), post_ids: []>

POST  

   => For Creating Post  we can create & tagged multiple foods name (Gujarati-food, south-Indians)
  => We also create album name  and also tagged album name so that our post image stores that album.
  => Also add Location  
  => and Tagged user from whom with you eating food.
Post.rb
post = Post.new
 => #<Post _id: 506e6a12a21a9c103e000017, _type: “Post”, created_at: nil, updated_at: nil, _randomization_key: nil, food_tag_list: nil, album_tag_list: nil, global_user_tag_list: nil, food_names: nil, message: nil, image_uid: nil, user_id: nil, picture_id: nil, location_id: nil, album_ids: [], shared_user_ids: [], food_ids: [],  like_count: 0, comment_count: 0>
1.9.3-p194-perf :165 > post.picture_id = pic.id
 => BSON::ObjectId(‘506e6490a21a9c105b000027’) 
 
1.9.3-p194-perf :166 > post.food_tag_list = [food1.name, food2.name]
 => [“Gujarati-foods”, “South-Indian”]
 
1.9.3-p194-perf :167 > post.album_tag_list = [album1.name, album2.name]
 => [“Album1”, “Album2”]
 
1.9.3-p194-perf :168 > post.food_names = “#{food1.name}, #{food2.name}”
 => “Gujarati-foods, South-Indian”
 
1.9.3-p194-perf :169 > post.message = “This Food is awesome”
 => “This Food is awesome”
 
1.9.3-p194-perf :170 > post.user_id = u.id
 => BSON::ObjectId(‘506e57e6a21a9c101d000001’)
 
1.9.3-p194-perf :171 > post.location_id = location.id
 => BSON::ObjectId(‘506e663ba21a9c103e000012’)
 
1.9.3-p194-perf :172 > post.album_ids = [album1.id, album2.id]
 => [BSON::ObjectId(‘506e6985a21a9c103e000014’), BSON::ObjectId(‘506e69a3a21a9c103e000015’)]
 
1.9.3-p194-perf :173 > post.shared_user_ids = [u1.id, u2]
 => [BSON::ObjectId(‘506e57eca21a9c101d000010’), BSON::ObjectId(‘506e57eba21a9c101d000006’)]
 
1.9.3-p194-perf :174 > post.food_ids = [food1.id, food2.id, food3.id]
 => [BSON::ObjectId(‘506e6580a21a9c103e00000e’), BSON::ObjectId(‘506e6592a21a9c103e00000f’)]
 
1.9.3-p194-perf :175 > post.save!
 => true
 
1.9.3-p194-perf :176 > post
 => #<Post _id: 506e6a12a21a9c103e000017, _type: “Post”, created_at: 2012-10-05 05:10:13 UTC, updated_at: 2012-10-05 05:10:13 UTC, _randomization_key: 0.5904246489602538, food_tag_list: [“Gujarati-foods”, “South-Indian”], album_tag_list: nil, global_user_tag_list: nil, food_names: “Gujarati-foods, South-Indian”, message: “This Food is awesome”, image_uid: nil, user_id: BSON::ObjectId(‘506e57e6a21a9c101d000001’), picture_id: BSON::ObjectId(‘506e6490a21a9c105b000027’), location_id: BSON::ObjectId(‘506e663ba21a9c103e000012’), album_ids: [BSON::ObjectId(‘506e6985a21a9c103e000014’), BSON::ObjectId(‘506e69a3a21a9c103e000015’), ], shared_user_ids: [BSON::ObjectId(‘506e57eca21a9c101d000010’), BSON::ObjectId(‘506e57eba21a9c101d000006’)], food_ids: [BSON::ObjectId(‘506e6580a21a9c103e00000e’), BSON::ObjectId(‘506e6592a21a9c103e00000f’), ], like_count: 0, comment_count: 0>

Notification 

  => Notification is Used when (user tagged, liked-post, comment)
 
Notification.rb
 
user.posts.first.notifications
  
=> [#<Notification _id: 506e59cea21a9c105b00000d, _type: “Notification”, created_at: 2012-10-05 03:53:50 UTC, updated_at: 2012-10-05 03:53:50 UTC, user_id: BSON::ObjectId(‘506e57eba21a9c101d000006’), subject_type: “Post”, subject_id: BSON::ObjectId(‘506e59cda21a9c105b000006’), secondary_subject_type: nil, secondary_subject_id: nil, event_type: “being_tagged”, read: false>, #<Notification _id: 506e59cea21a9c105b00000e, _type: “Notification”, created_at: 2012-10-05 03:53:50 UTC, updated_at: 2012-10-05 03:53:50 UTC, user_id: BSON::ObjectId(‘506e57eba21a9c101d00000b’), subject_type: “Post”, subject_id: BSON::ObjectId(‘506e59cda21a9c105b000006’), secondary_subject_type: nil, secondary_subject_id: nil, event_type: “being_tagged”, read: false>]
u.posts.first.notifications.collect(&:subject_id)
 => [BSON::ObjectId(‘506e59cda21a9c105b000006’), BSON::ObjectId(‘506e59cda21a9c105b000006’)]

 Comment

Comment.rb
post.comments
=> []
 
comment = post.comments.build
=> #<Comment _id: 506e71baa21a9c103e00001f, _type: “Comment”, created_at: nil, updated_at: nil, message: nil, user_id: nil, post_id: BSON::ObjectId(‘506e6a12a21a9c103e000017’)>
 
comment.message = “This Food is Too Good!”
 => “This Food is Too Good!”
comment.user_id = u.id
 => BSON::ObjectId(‘506e57e6a21a9c101d000001’)
1.9.3-p194-perf :225 > comment.save
 => true
1.9.3-p194-perf :226 > comment
 => #<Comment _id: 506e71baa21a9c103e00001f, _type: “Comment”, created_at: 2012-10-05 05:36:18 UTC, updated_at: 2012-10-05 05:36:18 UTC, message: “This Food is Too Good!”, user_id: BSON::ObjectId(‘506e57e6a21a9c101d000001’), post_id: BSON::ObjectId(‘506e6a12a21a9c103e000017’)>

Likeship.

Likeship.rb
LikeShip
=> When we like some one’s else post or Our Post
=> We store the User id who like that post as target.
=> also in field Post Like_count automatically update after when we like that post.
=> We can Create Likeship
 Likeship  From Rails Server’s Logs.
Started POST “/like” for 127.0.0.1 at 2012-10-05 12:36:12 +0530
  Processing by LikesController#create as */*
  Parameters: {“id”=>”506e6a12a21a9c103e000017”}
MONGODB (1ms) foodlove_development[‘system.namespaces’].find({})
MONGODB (0ms) foodlove_development[‘entities’].find({:_id=>BSON::ObjectId(‘506e57e6a21a9c101d000001’), :_type=>{“$in”=>[“User”]}}).limit(-1).sort([[:_id, :asc]])
MONGODB (4ms) foodlove_development[‘system.namespaces’].find({})
MONGODB (0ms) foodlove_development[‘posts’].find({:_id=>BSON::ObjectId(‘506e6a12a21a9c103e000017’)}).limit(-1).sort([[:_id, :asc]])
MONGODB (1ms) foodlove_development[‘system.namespaces’].find({})
MONGODB (0ms) foodlove_development[‘likeships’].find({“user_id”=>BSON::ObjectId(‘506e57e6a21a9c101d000001’), :target_id=>BSON::ObjectId(‘506e6a12a21a9c103e000017’), :_type=>{“$in”=>[“Likeship”]}}).limit(-1).sort([[:_id, :asc]])
MONGODB (25ms) foodlove_development[‘posts’].update({“_id”=>BSON::ObjectId(‘506e6a12a21a9c103e000017’)}, {“$inc”=>{“like_count”=>1}})
MONGODB (1ms) foodlove_development[‘likeships’].insert([{“_id”=>BSON::ObjectId(‘506e86e5a21a9c1aef000002’), “_type”=>”Likeship”, “target_id”=>BSON::ObjectId(‘506e6a12a21a9c103e000017’), “user_id”=>BSON::ObjectId(‘506e57e6a21a9c101d000001’), “updated_at”=>2012-10-05 07:06:13 UTC, “created_at”=>2012-10-05 07:06:13 UTC}])
user.likeships.last
 => #<Likeship _id: 506e86e5a21a9c1aef000002, _type: “Likeship”, created_at: 2012-10-05 07:06:13 UTC, updated_at: 2012-10-05 07:06:13 UTC, target_id: BSON::ObjectId(‘506e6a12a21a9c103e000017’), user_id: 
BSON::ObjectId(‘506e57e6a21a9c101d000001’)>

 Subscription

Subscription.rb
Subscriptions.
 
First User Collect all the Food_names
In Subscription Model There is Subscrible and Subscribable respective to User & Food.
Which User Subscribe which food,
Models Below.
foods = Food.all.collect(&:name)
 => [“Indian-cursin-“, “Pakistan-cursin”, “kumar”, “Sample-food”, “another-name”, “Veg-muffin-burger”, “Veg”, “Muffin-veg”, “india-veg”, “Pure-veg”, ” Punjabi”, “name”, “-con”, “Gujarati-foods”, ” South-Indian”, ” Punjabi-food”]
 
food = Food.last
=> #<Food _id: 506e6bb5a21a9c103e00001a, _type: “Food”, created_at: 2012-10-05 05:10:13 UTC, updated_at: 2012-10-05 05:10:13 UTC, name: ” Punjabi-food”, description: nil, external_uri: nil, cover_photo_uid: nil>
 
subscription = Subscription.new
 => #<Subscription _id: 506e8057a21a9c18d1000001, _type: “Subscription”, created_at: nil, updated_at: nil, food_id: nil, user_id: nil, subscriber_id: nil, subscribable_id: nil, subscribable_type: nil>
 
subscription.subscriber = user.id
 => BSON::ObjectId(‘506e57e6a21a9c101d000001’)
 
subscription.subscribable = food.id
 => BSON::ObjectId(‘506e6bb5a21a9c103e00001a’)
 
subscription.subscribable_type = “Food”
 => “Food”
1.9.3-p194-perf :028 > subscription.save
 => true
1.9.3-p194-perf :029 > subscription
 => #<Subscription _id: 506e8057a21a9c18d1000001, _type: “Subscription”, created_at: 2012-10-05 06:40:52 UTC, updated_at: 2012-10-05 06:41:31 UTC, food_id: nil, user_id: nil, subscriber_id: BSON::ObjectId(‘506e57e6a21a9c101d000001’), subscribable_id: BSON::ObjectId(‘506e57e6a21a9c101d000001’), subscribable_type: “Food”>
Food Subscription  Logs from Rails Server
Started GET “/foods/506e6bb5a21a9c103e000018/subscribe.html?_=1349418732805” for 127.0.0.1 at 2012-10-05 12:02:12 +0530
  Processing by FoodsController#subscribe as HTML
  Parameters: {“_”=>”1349418732805”, “id”=>”506e6bb5a21a9c103e000018”}
MONGODB (1ms) foodlove_development[‘system.namespaces’].find({})
MONGODB (0ms) foodlove_development[‘entities’].find({:_id=>BSON::ObjectId(‘506e57e6a21a9c101d000001’), :_type=>{“$in”=>[“User”]}}).limit(-1).sort([[:_id, :asc]])
MONGODB (1ms) foodlove_development[‘system.namespaces’].find({})
MONGODB (0ms) foodlove_development[‘foods’].find({:_id=>BSON::ObjectId(‘506e6bb5a21a9c103e000018’)}).limit(-1).sort([[:_id, :asc]])
MONGODB (1ms) foodlove_development[‘system.namespaces’].find({})
MONGODB (0ms) foodlove_development[‘$cmd’].find({“count”=>”subscriptions”, “query”=>{:subscriber_id=>BSON::ObjectId(‘506e57e6a21a9c101d000001’), :subscribable_id=>BSON::ObjectId(‘506e6bb5a21a9c103e000018’), :subscribable_type=>”Food”}, “fields”=>nil}).limit(-1)
MONGODB (0ms) foodlove_development[‘subscriptions’].insert([{“_id”=>BSON::ObjectId(‘506e7eeda21a9c1972000005’), “_type”=>”Subscription”, “subscriber_id”=>BSON::ObjectId(‘506e57e6a21a9c101d000001’), “subscribable_id”=>BSON::ObjectId(‘506e6bb5a21a9c103e000018’), “subscribable_type”=>”Food”, “updated_at”=>2012-10-05 06:32:13 UTC, “created_at”=>2012-10-05 06:32:13 UTC}])
 
 
 
Subscription.last
 => #<Subscription _id: 506e7eeda21a9c1972000005, _type: “Subscription”, created_at: 2012-10-05 06:32:13 UTC, updated_at: 2012-10-05 06:32:13 UTC, food_id: nil, user_id: nil, subscriber_id: BSON::ObjectId(‘506e57e6a21a9c101d000001’), subscribable_id: BSON::ObjectId(‘506e6bb5a21a9c103e000018’), subscribable_type: “Food”>
1.9.3-p194-perf :010 > Subscription.last.subscribable
 => #<Food _id: 506e6bb5a21a9c103e000018, _type: “Food”, created_at: 2012-10-05 05:10:13 UTC, updated_at: 2012-10-05 05:10:13 UTC, name: “Gujarati-foods”, description: nil, external_uri: nil, cover_photo_uid: nil>
1.9.3-p194-perf :011 > Subscription.last.subscriber
 => #<User _id: 506e57e6a21a9c101d000001, _type: “User”, created_at: 2012-10-05 03:45:46 UTC, updated_at: 2012-10-05 03:45:43 UTC, username: “mehul”,  profile_image_uid: “506e57eaa21a9c101d000002”, slug: “mehul”, email: “mehul@gmail.com”, encrypted_password: “$2a$10$VlBNciAOTsyiEJv5BIxNxezot4kBouV/vjEIv1s.n87IDAxC65/ca”, reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, authentication_token: “zfNykaeVzabtVNPHeZX4”, facebook_id: 775417639,  role: 1, about: nil, website: nil, devise_token: nil, auto_publish_facebook: true, >

On mongoDB Console.

use foodlove_development
db.posts.findOne({“_id” : ObjectId(“506e6a12a21a9c103e000017”)})
{
     “_id” : ObjectId(“506e6a12a21a9c103e000017”),
     “album_ids” : [
           ObjectId(“506e6985a21a9c103e000014”),
           ObjectId(“506e69a3a21a9c103e000015”)
          
     ],
     “shared_user_ids” : [
           ObjectId(“506e57eca21a9c101d000010”),
           ObjectId(“506e57eba21a9c101d000006”)
     ],
     “food_ids” : [
           ObjectId(“506e6580a21a9c103e00000e”),
           ObjectId(“506e6592a21a9c103e00000f”),
           ObjectId(“506e65a6a21a9c103e000010”)
          
     ],
     “repin_message” : “”,
     “like_count” : 1,
     “comment_count” : 1,
     “reshare_count” : 0,
     “repin_count” : 0,
     “_type” : “Post”,
     “picture_id” : ObjectId(“506e6490a21a9c105b000027”),
     “food_tag_list” : [
           “Gujarati-foods”,
           “South-Indian”
          
     ],
     “food_names” : “Gujarati-foods, South-Indian”,
     “message” : “This Food is awesome”,
     “user_id” : ObjectId(“506e57e6a21a9c101d000001”),
     “location_id” : ObjectId(“506e663ba21a9c103e000012”),
     “updated_at” : ISODate(“2012-10-05T05:10:13Z”),
     “created_at” : ISODate(“2012-10-05T05:10:13Z”),
     “_randomization_key” : 0.5904246489602538
}
Cheers
Mehul Gurjar