File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 70
70
# find a document by its ID
71
71
get ' /document/:id/?' do
72
72
content_type :json
73
- document_by_id(params[:id ]).to_json
73
+ document_by_id(params[:id ])
74
74
end
75
75
```
76
76
82
82
post ' /new_document/?' do
83
83
content_type :json
84
84
new_id = settings.mongo_db[' test' ].insert params
85
- document_by_id(new_id).to_json
85
+ document_by_id(new_id)
86
86
end
87
87
```
88
88
@@ -95,7 +95,7 @@ put '/update/:id/?' do
95
95
content_type :json
96
96
id = object_id(params[:id ])
97
97
settings.mongo_db[' test' ].update({:_id => id}, params)
98
- document_by_id(id).to_json
98
+ document_by_id(id)
99
99
end
100
100
101
101
# update the document specified by :id, setting just its
@@ -106,8 +106,8 @@ put '/update_name/:id/?' do
106
106
id = object_id(params[:id ])
107
107
name = params[:name ]
108
108
settings.mongo_db[' test' ].
109
- update(:_id => id, {" $set" => {:name => name}})
110
- document_by_id(id).to_json
109
+ update({ :_id => id} , {" $set" => {:name => name}})
110
+ document_by_id(id)
111
111
end
112
112
```
113
113
You can’t perform that action at this time.
0 commit comments