From d6df77b4ab74ace970ac159f602e8db65cab55ad Mon Sep 17 00:00:00 2001 From: yuvaneshkm Date: Sat, 28 Sep 2024 07:38:52 +0530 Subject: [PATCH] updated_version_1.3 --- src/dbsconnector/databases.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dbsconnector/databases.py b/src/dbsconnector/databases.py index e66ac07..4bd5335 100644 --- a/src/dbsconnector/databases.py +++ b/src/dbsconnector/databases.py @@ -1,5 +1,6 @@ # importing necessary libraries import pandas as pd +import pymongo from pymongo import MongoClient from pathlib import Path import warnings @@ -88,5 +89,7 @@ def upload_object( def load_object(self, database: str, collection_name: str, object_name: str): database_connect = self.mongoclinet[database] collection = database_connect[collection_name] - object_ = collection.find_one({"object_name": object_name}) + object_ = collection.find_one( + {"object_name": object_name}, sort=[("_id", pymongo.DESCENDING)] + ) return object_