@@ -51,10 +51,10 @@ query. We can do so using **PyMongo**::
51
51
from pymongo import MongoClient
52
52
client = MongoClient()
53
53
client.db.data.insert_many([
54
- {'_id': 1, 'amount': 21, 'last_updated': datetime(2020, 12, 10, 1, 3, 1)},
55
- {'_id': 2, 'amount': 16, 'last_updated': datetime(2020, 7, 23, 6, 7, 11)},
56
- {'_id': 3, 'amount': 3, 'last_updated': datetime(2021, 3, 10, 18, 43, 9)},
57
- {'_id': 4, 'amount': 0, 'last_updated': datetime(2021, 2, 25, 3, 50, 31)}])
54
+ {'_id': 1, 'amount': 21, 'last_updated': datetime(2020, 12, 10, 1, 3, 1), 'account': { 'name': "Customer1", 'account_number': 1}}, "txns": [1, 2, 3] },
55
+ {'_id': 2, 'amount': 16, 'last_updated': datetime(2020, 7, 23, 6, 7, 11), 'account': { 'name': "Customer2", 'account_number': 2}}, "txns": [1, 2, 3] },
56
+ {'_id': 3, 'amount': 3, 'last_updated': datetime(2021, 3, 10, 18, 43, 9), 'account': { 'name': "Customer3", 'account_number': 3}}, "txns": [1, 2, 3] },
57
+ {'_id': 4, 'amount': 0, 'last_updated': datetime(2021, 2, 25, 3, 50, 31), 'account': { 'name': "Customer4", 'account_number': 4}}, "txns": [1, 2, 3] }])
58
58
59
59
Defining the schema
60
60
-------------------
@@ -79,7 +79,7 @@ Nested data (embedded documents) are also supported::
79
79
Arrays (and nested arrays) are also supported::
80
80
81
81
from pymongoarrow.api import Schema
82
- schema = Schema({'_id': int, 'amount': float, 'account ': list_(int32())})
82
+ schema = Schema({'_id': int, 'amount': float, 'txns ': list_(int32())})
83
83
84
84
.. note ::
85
85
@@ -119,7 +119,7 @@ Nested data (embedded documents) are also supported::
119
119
Arrays (and nested arrays) are also supported::
120
120
121
121
from pymongoarrow.api import Schema
122
- schema = Schema({'_id': int, 'amount': float, 'account ': list_(int32())})
122
+ schema = Schema({'_id': int, 'amount': float, 'txns ': list_(int32())})
123
123
arrow_table = client.db.data.find_arrow_all({'amount': {'$gt': 0}}, schema=schema)
124
124
125
125
Aggregate operations
0 commit comments