Congomongo
Upcoming SlideShare
Loading in...5
×
 

Congomongo

on

  • 27,093 views

Apresentação de congomongo pro Ldc da minha empresa

Apresentação de congomongo pro Ldc da minha empresa

Statistics

Views

Total Views
27,093
Views on SlideShare
27,093
Embed Views
0

Actions

Likes
0
Downloads
3
Comments
1

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Congomongo Congomongo Presentation Transcript

  • Code• Import: (use somnium.congomongo).• Connect:(def conn (make-connection "ldc" :host "127.0.0.1" :port 27017))
  • Code• Global Connection: (set-connection! conn)• Local Connection: (with-mongo conn (insert! :membros {:name “Poletto"}))
  • Code• Inserts: (insert! :membros {:nome "Poletto", :idade 28}) {:idade 28, :nome "Poletto", :_id #<ObjectId 4ecaf362f7ef6db25f5a2ccd>} (insert! :membros {:nome "Shooter", :idade 21}) {:idade 21, :nome "Shooter", :_id #<ObjectId 4ecaf438f7ef6db25f5a2cce>} (insert! :membros {:nome "Diego", :idade 26}) {:idade 26, :nome "Diego", :_id #<ObjectId 4ecaf59cf7ef6db25f5a2ccf>}
  • Code• Fetch: (fetch :membros) ( :idade 28, :nome "Poletto"} { :idade 21, :nome "Shooter"} { :idade 26, :nome "Diego"})
  • Code• Fetch: (fetch-one :membros :where {:idade {:$lt 25}}) {:idade 21, :nome "Shooter"} (fetch-one :membros :where {:nome "Poletto"}) {:idade 28, :nome "Poletto"} (fetch-count :membros) 3
  • Code• Update: (def m (fetch-one :membros)) #ldc_congomongo.core/m (update! :membros m (merge m { :lt {:tema "congomongo" } }) {:lt {:tema "congomongo"}, :idade 28, :nome "Poletto"}
  • Code• Destroy: (def m (fetch-one :membros)) #ldc_congomongo.core/m (destroy! :membros m) #<WriteResult N/A>