File tree Expand file tree Collapse file tree
packages/google-cloud-firestore Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3535 AsyncQuery ,
3636 AsyncTransaction ,
3737 AsyncWriteBatch ,
38+ BSONBinary ,
39+ BSONDecimal128 ,
40+ BSONInt32 ,
41+ BSONMaxKey ,
42+ BSONMinKey ,
43+ BSONObjectID ,
44+ BSONRegex ,
45+ BSONTimestamp ,
3846 Client ,
3947 CollectionGroup ,
4048 CollectionReference ,
92100 "async_transactional" ,
93101 "AsyncTransaction" ,
94102 "AsyncWriteBatch" ,
103+ "BSONBinary" ,
104+ "BSONDecimal128" ,
105+ "BSONInt32" ,
106+ "BSONMaxKey" ,
107+ "BSONMinKey" ,
108+ "BSONObjectID" ,
109+ "BSONRegex" ,
110+ "BSONTimestamp" ,
95111 "Client" ,
96112 "CountAggregation" ,
97113 "CollectionGroup" ,
Original file line number Diff line number Diff line change 4646from google .cloud .firestore_v1 .base_pipeline import SubPipeline
4747from google .cloud .firestore_v1 .base_query import And , FieldFilter , Or
4848from google .cloud .firestore_v1 .batch import WriteBatch
49+ from google .cloud .firestore_v1 .bson import (
50+ BSONBinary ,
51+ BSONDecimal128 ,
52+ BSONInt32 ,
53+ BSONMaxKey ,
54+ BSONMinKey ,
55+ BSONObjectID ,
56+ BSONRegex ,
57+ BSONTimestamp ,
58+ )
4959from google .cloud .firestore_v1 .client import Client
5060from google .cloud .firestore_v1 .collection import CollectionReference
5161from google .cloud .firestore_v1 .document import DocumentReference
147157 "async_transactional" ,
148158 "AsyncTransaction" ,
149159 "AsyncWriteBatch" ,
160+ "BSONBinary" ,
161+ "BSONDecimal128" ,
162+ "BSONInt32" ,
163+ "BSONMaxKey" ,
164+ "BSONMinKey" ,
165+ "BSONObjectID" ,
166+ "BSONRegex" ,
167+ "BSONTimestamp" ,
150168 "Client" ,
151169 "CountAggregation" ,
152170 "CollectionGroup" ,
Original file line number Diff line number Diff line change 4444import google
4545from google .cloud import exceptions # type: ignore
4646from google .cloud .firestore_v1 import transforms , types
47+ from google .cloud .firestore_v1 .bson import BSONType
4748from google .cloud .firestore_v1 .field_path import FieldPath , parse_field_path
4849from google .cloud .firestore_v1 .types import common , document , write
4950from google .cloud .firestore_v1 .types .write import DocumentTransform
@@ -182,6 +183,9 @@ def encode_value(value) -> types.document.Value:
182183 if value is None :
183184 return document .Value (null_value = struct_pb2 .NULL_VALUE )
184185
186+ if isinstance (value , BSONType ):
187+ return encode_value (value .to_map_value ())
188+
185189 # Must come before int since ``bool`` is an integer subtype.
186190 if isinstance (value , bool ):
187191 return document .Value (boolean_value = value )
You can’t perform that action at this time.
0 commit comments