def updatePoint(self, point: Point) -> Point: if len(point.id) != 24: return point col = self.getColl(point.mapId) result = col.update_one({'_id': ObjectId(point.id)}, {'$set': point.toDBMap()}, upsert=True) if result.upserted_id: point.id = str(result.upserted_id) path = edgeDao.findEdgeByPointAId(point.id, point.mapId) for item in path: item.pointA = { 'id': point.id, 'planCoordinate': point.planCoordinate, 'actualCoordinate': point.actualCoordinate } edgeDao.updateEdge(item) path = edgeDao.findEdgeByPointBId(point.id, point.mapId) for item in path: item.pointB = { 'id': point.id, 'planCoordinate': point.planCoordinate, 'actualCoordinate': point.actualCoordinate } edgeDao.updateEdge(item) return point
def savePoint(self, point: Point) -> Point: col = self.getColl(point.mapId) result = col.insert_one(point.toDBMap()) point.id = str(result.inserted_id) return point