Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The technique for getting a key in a document as a value in MongoDB Python is to use the dot notation. For example, if you have a document like this:

{'name': 'John', 'age': 30, 'city': 'New York'}

You can access the value of the "name" key by using dot notation like this:

document = {'name': 'John', 'age': 30, 'city': 'New York'}
name = document['name']

In this case, the value of "name" will be "John".