I have stored around 120 text files in a mongoDB database through connecting my local instance to mongodb cloud. I used pymongo to automate the insertion of the contents of each text file into mongodb cloud. The collection of 120 documents looks like this:
'''
{ _id:ObjectID(....),
nameTextdoc.txt:"text_document",
content: ['Each sentence stored in an array.','...']
'''
I am trying to retrieve the nameTextdoc.txt field and content field by using:
'''
collections.find_one({'nameTextdoc.txt': 'text_doc'})
'''
in a python script using pymongo. For some reason I receive None when I run this query. However, when I run:
'''
collections.find_one({})
'''
I get the entire document.
I would like to get assistance on writing a query that would retrieve the entirety of the text file by querying the name of the text file. I have periods in my key names, which may be the specific reason why I cannot retrieve them. Any help would be much appreciated.