@@ -144,34 +144,35 @@ client.schema.create(
144144### Using the Objects endpoint
145145``` ruby
146146# Create a new data object.
147- client.objects.create(
147+ output = client.objects.create(
148148 class_name: ' Question' ,
149149 properties: {
150150 answer: ' 42' ,
151151 question: ' What is the meaning of life?' ,
152152 category: ' philosophy'
153153 }
154154)
155+ uuid = output[" id" ]
155156
156157# Lists all data objects in reverse order of creation.
157158client.objects.list()
158159
159160# Get a single data object.
160161client.objects.get(
161162 class_name: " Question" ,
162- id: " uuid"
163+ id: uuid
163164)
164165
165166# Check if a data object exists.
166167client.objects.exists?(
167168 class_name: " Question" ,
168- id: " uuid"
169+ id: uuid
169170)
170171
171172# Perform a partial update on an object based on its uuid.
172173client.objects.update(
173174 class_name: " Question" ,
174- id: " uuid" ,
175+ id: uuid,
175176 properties: {
176177 category: " simple-math"
177178 }
@@ -180,7 +181,7 @@ client.objects.update(
180181# Replace an object based on its uuid.
181182client.objects.replace(
182183 class_name: " Question" ,
183- id: " uuid" ,
184+ id: uuid,
184185 properties: {
185186 question: " What does 6 times 7 equal to?" ,
186187 category: " math" ,
@@ -191,34 +192,35 @@ client.objects.replace(
191192# Delete a single data object from Weaviate.
192193client.objects.delete(
193194 class_name: " Question" ,
194- id: " uuid"
195+ id: uuid
195196)
196197
197198# Batch create objects
198- client.objects.batch_create(objects: [
199+ output = client.objects.batch_create(objects: [
199200 {
200201 class : " Question" ,
201202 properties: {
202- answer: " 42" ,
203- question: " What is the meaning of life?" ,
204- category: " philosophy"
203+ answer: " 42" ,
204+ question: " What is the meaning of life?" ,
205+ category: " philosophy"
205206 }
206207 }, {
207208 class : " Question" ,
208209 properties: {
209- answer: " 42" ,
210- question: " What does 6 times 7 equal to?" ,
211- category: " math"
210+ answer: " 42" ,
211+ question: " What does 6 times 7 equal to?" ,
212+ category: " math"
212213 }
213214 }
214215])
216+ uuids = output.pluck(" id" )
215217
216218# Batch delete objects
217219client.objects.batch_delete(
218220 class_name: " Question" ,
219221 where: {
220- valueString: " uuid " ,
221- operator: " Equal " ,
222+ valueStringArray: uuids ,
223+ operator: " ContainsAny " ,
222224 path: [" id" ]
223225 }
224226)
0 commit comments