diff --git a/sql/engines/mongo.py b/sql/engines/mongo.py index 0bf03e2b62..7812eadf4d 100644 --- a/sql/engines/mongo.py +++ b/sql/engines/mongo.py @@ -591,10 +591,10 @@ def get_all_columns_by_tb(self, db_name, tb_name, **kwargs): for d in db[collection_name].find().limit(2): documents_sample.append(d) else: - for d in db[collection_name].find().sort([("$natural", 1)]).limit(1): + for d in db[collection_name].find().sort([("_id", 1)]).limit(1): documents_sample.append(d) - for d in db[collection_name].find().sort([("$natural", -1)]).limit(1): + for d in db[collection_name].find().sort([("_id", -1)]).limit(1): documents_sample.append(d) columns = [] # _merge_property_names