File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -187,12 +187,12 @@ cdef class BuilderManager:
187
187
raise ValueError (" Could not append raw value to" , full_key.decode(' utf8' ))
188
188
189
189
# Recurse into documents.
190
- if value_t == BSON_TYPE_DOCUMENT:
190
+ if value_t == BSON_TYPE_DOCUMENT and builder.type_marker == BSON_TYPE_DOCUMENT :
191
191
bson_iter_recurse(doc_iter, & child_iter)
192
192
self .parse_document(& child_iter, full_key, BSON_TYPE_DOCUMENT)
193
193
194
194
# Recurse into arrays.
195
- if value_t == BSON_TYPE_ARRAY:
195
+ if value_t == BSON_TYPE_ARRAY and builder.type_marker == BSON_TYPE_ARRAY :
196
196
bson_iter_recurse(doc_iter, & child_iter)
197
197
self .parse_document(& child_iter, full_key, BSON_TYPE_ARRAY)
198
198
Original file line number Diff line number Diff line change @@ -492,6 +492,12 @@ def test_schema_missing_field(self):
492
492
out = func (self .coll , {} if func == find_arrow_all else [], schema = schema ).drop (["_id" ])
493
493
self .assertEqual (out ["list_field" ].to_pylist (), expected )
494
494
495
+ def test_schema_incorrect_data_type (self ):
496
+ self .coll .delete_many ({})
497
+ self .coll .insert_one ({"x" : {"y" : 1 }})
498
+ out = find_arrow_all (self .coll , {}, schema = Schema ({"x" : str }))
499
+ assert out .to_pylist () == [{"x" : None }]
500
+
495
501
def test_auto_schema_nested (self ):
496
502
# Create table with random data of various types.
497
503
_ , data = self ._create_nested_data ()
You can’t perform that action at this time.
0 commit comments