Skip to content

Commit 845b165

Browse files
arturdryomovbehackett
authored andcommitted
Use syntax highlighting in the readme file.
1 parent d80ed73 commit 845b165

File tree

1 file changed

+33
-31
lines changed

1 file changed

+33
-31
lines changed

README.rst

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -51,37 +51,39 @@ Examples
5151
========
5252
Here's a basic example (for more see the *examples* section of the docs):
5353

54-
>>> import pymongo
55-
>>> client = pymongo.MongoClient("localhost", 27017)
56-
>>> db = client.test
57-
>>> db.name
58-
u'test'
59-
>>> db.my_collection
60-
Collection(Database(MongoClient('localhost', 27017), u'test'), u'my_collection')
61-
>>> db.my_collection.save({"x": 10})
62-
ObjectId('4aba15ebe23f6b53b0000000')
63-
>>> db.my_collection.save({"x": 8})
64-
ObjectId('4aba160ee23f6b543e000000')
65-
>>> db.my_collection.save({"x": 11})
66-
ObjectId('4aba160ee23f6b543e000002')
67-
>>> db.my_collection.find_one()
68-
{u'x': 10, u'_id': ObjectId('4aba15ebe23f6b53b0000000')}
69-
>>> for item in db.my_collection.find():
70-
... print item["x"]
71-
...
72-
10
73-
8
74-
11
75-
>>> db.my_collection.create_index("x")
76-
u'x_1'
77-
>>> for item in db.my_collection.find().sort("x", pymongo.ASCENDING):
78-
... print item["x"]
79-
...
80-
8
81-
10
82-
11
83-
>>> [item["x"] for item in db.my_collection.find().limit(2).skip(1)]
84-
[8, 11]
54+
.. code-block:: pycon
55+
56+
>>> import pymongo
57+
>>> client = pymongo.MongoClient("localhost", 27017)
58+
>>> db = client.test
59+
>>> db.name
60+
u'test'
61+
>>> db.my_collection
62+
Collection(Database(MongoClient('localhost', 27017), u'test'), u'my_collection')
63+
>>> db.my_collection.save({"x": 10})
64+
ObjectId('4aba15ebe23f6b53b0000000')
65+
>>> db.my_collection.save({"x": 8})
66+
ObjectId('4aba160ee23f6b543e000000')
67+
>>> db.my_collection.save({"x": 11})
68+
ObjectId('4aba160ee23f6b543e000002')
69+
>>> db.my_collection.find_one()
70+
{u'x': 10, u'_id': ObjectId('4aba15ebe23f6b53b0000000')}
71+
>>> for item in db.my_collection.find():
72+
... print item["x"]
73+
...
74+
10
75+
8
76+
11
77+
>>> db.my_collection.create_index("x")
78+
u'x_1'
79+
>>> for item in db.my_collection.find().sort("x", pymongo.ASCENDING):
80+
... print item["x"]
81+
...
82+
8
83+
10
84+
11
85+
>>> [item["x"] for item in db.my_collection.find().limit(2).skip(1)]
86+
[8, 11]
8587
8688
Documentation
8789
=============

0 commit comments

Comments
 (0)