File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -160,6 +160,40 @@ module.exports = class Node extends PropertyContainer
160160
161161 catch error
162162 throw adjustError error
163+ #
164+ # Delete this node from the given index.
165+ #
166+ # @param index {String} The name of the index, e.g. `'users'`.
167+ # @param callback {Function}
168+ #
169+ unindex : (index , _ ) ->
170+ try
171+ # TODO
172+ if not @exists
173+ throw new Error ' Node must exists before unindexing properties'
174+
175+ services = @db .getServices _
176+ # version = @db.getVersion _
177+
178+ # encodedKey = encodeURIComponent key
179+ # encodedValue = encodeURIComponent value
180+ url = " #{ services .node_index } /#{ index} /#{ @id } "
181+
182+ response = @_request .delete
183+ url : url
184+ json : @self
185+ , _
186+
187+
188+ if response .statusCode isnt status .NO_CONTENT
189+ # database error
190+ throw response
191+
192+ # success
193+ return
194+
195+ catch error
196+ throw adjustError error
163197
164198 #
165199 # Uniquely add this node to the given index under the given key-value pair.
You can’t perform that action at this time.
0 commit comments