@@ -146,37 +146,6 @@ def __check_okay_to_chain(self):
146
146
if self .__retrieved or self .__id is not None :
147
147
raise InvalidOperation ("cannot set options after executing query" )
148
148
149
- # TODO complete deprecation by removing this method
150
- def slave_okay (self , slave_okay = True ):
151
- """(DEPRECATED) Specify whether this query should be allowed to execute on a slave.
152
-
153
- This method is deprecated and will be removed. Use the slave_okay
154
- parameter to `pymongo.collection.Collection.find` instead.
155
-
156
- By default, certain queries are not allowed to execute on mongod
157
- instances running in slave mode. If `slave_okay` is True then this
158
- query will be allowed to execute on slave instances. If False, the
159
- default behavior applies.
160
-
161
- Settings made through calls to this method take precedence over any
162
- settings made elsewhere (like the slave_okay option when creating a
163
- Connection). The last `slave_okay` applied to this cursor
164
- takes precedence.
165
-
166
- Raises InvalidOperation if this cursor has already been used.
167
-
168
- :Parameters:
169
- - `slave_okay` (optional): should this query be allowed to execute on
170
- slave instances
171
- """
172
- warnings .warn ("the slave_okay method is deprecated and will"
173
- " be removed - use the slave_okay paramater to find()"
174
- " instead" , DeprecationWarning )
175
- self .__check_okay_to_chain ()
176
-
177
- self .__slave_okay = slave_okay
178
- return self
179
-
180
149
def limit (self , limit ):
181
150
"""Limits the number of results to be returned by this cursor.
182
151
@@ -259,17 +228,6 @@ def explain(self):
259
228
c .__limit = - abs (c .__limit )
260
229
return c .next ()
261
230
262
- def __index_name_to_list (self , index_name ):
263
- """Convert an index specified by name to an index spec list.
264
- """
265
- # NOTE this is broken for indexes on key names containing '_'
266
- index_list = []
267
- tokens = index_name .split ("_" )
268
- for key , direction in zip (tokens [::2 ], tokens [1 ::2 ]):
269
- index_list .append ((key , int (direction )))
270
- return index_list
271
-
272
- # TODO at some point fully deprecate index name - it could be buggy
273
231
def hint (self , index ):
274
232
"""Adds a 'hint', telling Mongo the proper index to use for the query.
275
233
@@ -292,14 +250,8 @@ def hint(self, index):
292
250
self .__hint = None
293
251
return self
294
252
295
- if not isinstance (index , (types .StringTypes , types .ListType )):
296
- raise TypeError ("hint takes an index name or "
297
- "a list specifying an index" )
298
- if isinstance (index , types .StringTypes ):
299
- warnings .warn ("hinting using an index name is deprecated and will"
300
- " be removed - use a regular index spec instead" ,
301
- DeprecationWarning )
302
- index = self .__index_name_to_list (index )
253
+ if not isinstance (index , (types .ListType )):
254
+ raise TypeError ("hint takes a list specifying an index" )
303
255
self .__hint = pymongo ._index_document (index )
304
256
return self
305
257
0 commit comments