May-12-2023, 11:30 AM
(May-11-2023, 03:49 PM)snippsat Wrote:Pymongo Wrote:Thecount()
method was deprecated in pymongo version 3.7 and removed in version 4.0. Instead,
you can use thecount_documents()
method to achieve the same functionality.
So can try this:
def saveFile(): conn = MongoClient("xx.xx.xx.xx:27017") TravelHotelsPricelineDb = conn.travelHotelsPriceline rawLocationsHotelsPricelineDatacount = TravelHotelsPricelineDb.rawLocationsData.count_documents({}) finishedLocationHotelsPricelineValidDatacount = TravelHotelsPricelineDb.finishedLocationsData.count_documents({"metaData.status": "VALID"}) with open("/home/tomcat/scripts/HotelOutput_new_pricingDataLine_data.txt", "a") as text_file: text_file.write('{0} {1} {2}\n'.format(d1, rawLocationsHotelsPricelineDatacount, finishedLocationHotelsPricelineValidDatacount)) saveFile()Ahh those long👀 names.
Thanks Snippsat.All the issues resolved . Much appreciated.