-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
I have a collection and in each document there are a certain set of fields, but not all documents contain all fields. For example, in collection "foo" we can have three documents:
{"client_name": "john doe",
"product": "car",
"car_colour": "red"},
{"client_name": "jane doe",
"product": "bike",
"bike_colour": "blue"},
{"client_name": "jack doe"
"product": NULL}Each one is a client that bought a certain product and because of that other fields reflect the product that he bought and not every document has every single field.
If I was trying to retrieve all documents i would use:
filter = Mongoc.BSON("""{"projection": {"car_colour": true}}""")
res = Mongoc.find(foo, options=filter)It would return an error stating: KeyError: key "car_colour" not found
I was expecting to it return all documents and in those docs that have fields that don't exists in other documents, just return empty in that field. From my experience Python does something similar with PyMongo.
Julia: 1.9.1 Mongoc: 0.9.0
edit: Added version of Julia and Mongoc
Metadata
Metadata
Assignees
Labels
No labels