diff --git a/api/acquisitions.py b/api/acquisitions.py index 32bfdc768185e6f885275ecef602fc99c653fe35..17921948fd1b60b42430159c1414294c05923f2d 100644 --- a/api/acquisitions.py +++ b/api/acquisitions.py @@ -95,7 +95,7 @@ class Acquisitions(containers.ContainerList): json_body['files'] = [] if 'timestamp' in json_body: json_body['timestamp'] = util.parse_timestamp(json_body['timestamp']) - return {'_id': str(self.dbc.insert_one(json_body))} + return {'_id': str(self.dbc.insert_one(json_body).inserted_id)} def get(self, sid): """Return the list of Session Acquisitions.""" diff --git a/api/collections.py b/api/collections.py index 637287546c8e3abe59224c03d75d462403b226e7..ab7acb2e98220667019f7d8d87f59ab5ec53d160 100644 --- a/api/collections.py +++ b/api/collections.py @@ -199,7 +199,7 @@ class Collections(containers.ContainerList): json_body['curator'] = self.uid json_body['timestamp'] = datetime.datetime.utcnow() json_body['permissions'] = [{'_id': self.uid, 'access': 'admin'}] - return {'_id': str(self.dbc.insert_one(json_body))} + return {'_id': str(self.dbc.insert_one(json_body).inserted_id)} def get(self): """Return the list of Collections.""" diff --git a/api/containers.py b/api/containers.py index fbf0446319eecb9d8f83554c889ca03221e84f65..7d3847d4283ecf1df7bbc6123a2b08cbada418f8 100644 --- a/api/containers.py +++ b/api/containers.py @@ -244,7 +244,7 @@ class Container(base.RequestHandler): filepath = os.path.join(self.app.config['data_path'], str(_id)[-3:] + '/' + str(_id), filename) if self.request.GET.get('ticket') == '': # request for download ticket ticket = util.download_ticket(self.request.client_addr, 'file', _id, filename, fileinfo['filesize']) - return {'ticket': self.app.db.downloads.insert_one(ticket)} + return {'ticket': self.app.db.downloads.insert_one(ticket).inserted_id} else: # authenticated or ticketed (unauthenticated) download zip_member = self.request.GET.get('member') if self.request.GET.get('info', '').lower() in ('1', 'true'): diff --git a/api/projects.py b/api/projects.py index e36ae85e39737f491f798354443332e41023286e..b745018cb51348b9b90b62dfc27ba9865b75a1c7 100644 --- a/api/projects.py +++ b/api/projects.py @@ -110,7 +110,7 @@ class Projects(containers.ContainerList): json_body['public'] = json_body.get('public', False) json_body['files'] = [] json_body['timestamp'] = datetime.datetime.utcnow() - return {'_id': str(self.dbc.insert_one(json_body))} + return {'_id': str(self.dbc.insert_one(json_body).inserted_id)} def get(self, uid=None, gid=None): """Return the User's list of Projects.""" diff --git a/api/sessions.py b/api/sessions.py index a3462a384c25983b5c500ab75bf33c48bd53bb20..8d4fffc6be77d945225cf108d9bf5f1d79bc6596 100644 --- a/api/sessions.py +++ b/api/sessions.py @@ -100,7 +100,7 @@ class Sessions(containers.ContainerList): json_body['files'] = [] if 'timestamp' in json_body: json_body['timestamp'] = util.parse_timestamp(json_body['timestamp']) - return {'_id': str(self.dbc.insert_one(json_body))} + return {'_id': str(self.dbc.insert_one(json_body).inserted_id)} def get(self, pid=None, gid=None): """Return the list of project or group sessions."""