mongodb app demo

Hi,

Can any body help me to prepare a small demo of mongoid oriented application that will

hold contacts details of person.

1.CRUD operation on contacts using scaffold.

Fields a) Name of preson-> String b) Phone->will split in two part(i m not sure abt how it work but here need to initialize a object that will take care of this)[it is one of prominent feature of mongodb] -Country Code->String -Number->String c)Email(will multiple) ->Array d)Address(will Multiple)-> but wanted to store in other table named as “address” will hold field “details”

I am going through google but not getting expected support.

Every day i use to stretch my hair when ever coming around this mongodb feature.

Pravin,

mongoid.org has very clear instructions on how to setup fields in your model. What code have you already written? Are you facing any problems? I would recommend, you write some code rather than searching google for a readymade solution! :slight_smile:

Fields a) Name of preson-> String

b) Phone->will split in two part(i m not sure abt how it work but here need to initialize a object that will take care of this)[it is one of prominent feature of mongodb] -Country Code->String -Number->String c)Email(will multiple) ->Array d)Address(will Multiple)-> but wanted to store in other table named as “address” will hold field “details”

class Person

include Mongoid::Document

field :name, type: String

field :phone, type: Array # keep area code as phone[0] and phone[1] as the number if required.

has_many :addresses

end

class Address

include Mongoid::Document

field :street, type: String

belongs_to :person

end