@@ -71,11 +71,12 @@ def _auto_init(self, cr, context=None):
71
71
collection = db [self ._table ]
72
72
#Create index for the id field
73
73
try :
74
- collection .ensure_index ([('id' , pymongo .ASCENDING )],
75
- ttl = 300 ,
76
- unique = True )
74
+ # Replace for create_index in a future, ensure_index deprecated since 3.
75
+ collection .ensure_index ([('id' , pymongo .ASCENDING )], cache_for = 300 , unique = True )
77
76
except pymongo .errors .OperationFailure as e :
78
- if e .details and "already exists with different options" in e .details .get ("errmsg" , " " ):
77
+ if e .details and "An existing index has the same name as the requested index" in e .details .get ("errmsg" , " " ):
78
+ pass
79
+ elif e .details and "already exists with different options" in e .details .get ("errmsg" , " " ):
79
80
pass
80
81
else :
81
82
raise
@@ -109,7 +110,7 @@ def _auto_init(self, cr, context=None):
109
110
{'$set' : def_values },
110
111
upsert = False ,
111
112
manipulate = False ,
112
- safe = True ,
113
+ w = 1 ,
113
114
multi = True )
114
115
115
116
if db .error ():
@@ -489,8 +490,7 @@ def search(self, cr, user, args, offset=0, limit=0, order=None,
489
490
return collection .find (
490
491
new_args ,
491
492
{'id' : 1 },
492
- no_cursor_timeout = True ,
493
- modifiers = {"$snapshot" : False },
493
+ no_cursor_timeout = True
494
494
).count ()
495
495
496
496
mongo_cr = collection .find (
@@ -499,8 +499,8 @@ def search(self, cr, user, args, offset=0, limit=0, order=None,
499
499
skip = int (offset ),
500
500
limit = int (limit ),
501
501
no_cursor_timeout = True ,
502
- modifiers = {"$snapshot" : False },
503
502
sort = self ._compute_order (cr , user , order ))
503
+ # Removed modifiers={"$snapshot": False}, False by default
504
504
505
505
res = [x ['id' ] for x in mongo_cr if 'id' in x ]
506
506
0 commit comments