def delete_collection_items(self): coll = self.reference.get_collection() qs = QuerySet(coll) q = qs.get_query(self.api_arguments, self.objects) for f in self.additional_filters: q = q.filter(f) print("Delete collection items") print(q) if not self.delete_all and not qs.is_restricted(self.api_arguments, self.objects): raise PermissionError("Cannot delete all collection items without a specific request.") print([x for x in q.run(coll.application.connection)]) return q.delete(durability=self.durability, return_changes=self.return_changes).run(coll.application.connection)
def get_collection_items(self): coll = self.reference.get_collection() if self.reference.format in {'schema', 'help'}: return coll qs = QuerySet(coll) q = qs.get_query(self.api_arguments, self.objects) for f in self.additional_filters: q = q.filter(f) if qs.use_raw_results: results = q.run(coll.application.connection) try: return [x for x in results] except: return {"_": results} else: return [x for x in coll.q(q)]
def get_collection_items(self): coll = self.reference.get_collection() if self.reference.format in {"schema", "help"}: return coll qs = QuerySet(coll) q = qs.get_query(self.api_arguments, self.objects) for f in self.additional_filters: q = q.filter(f) if qs.use_raw_results: results = q.run(coll.application.connection) try: return [x for x in results] except: return {"_": results} else: return [x for x in coll.q(q)]
def delete_collection_items(self): coll = self.reference.get_collection() qs = QuerySet(coll) q = qs.get_query(self.api_arguments, self.objects) for f in self.additional_filters: q = q.filter(f) print("Delete collection items") print(q) if not self.delete_all and not qs.is_restricted( self.api_arguments, self.objects): raise PermissionError( "Cannot delete all collection items without a specific request." ) print([x for x in q.run(coll.application.connection)]) return q.delete(durability=self.durability, return_changes=self.return_changes).run( coll.application.connection)