@@ -599,6 +599,8 @@ serialization-related attributes:
599599- ``[BsonRepresentation()]``, which specifies serialization of the ``Price`` field as a BSON ``Double`` type
600600- ``[BsonDefaultValue()]``, which sets the ``Name`` property to
601601 ``"Generic item"`` if no value has been assigned to it
602+ - ``[BsonDateTimeOptions(DateOnly = true)]``, which specifies that the ``DateTime`` property
603+ represents only a date value, with no associated time
602604
603605.. literalinclude:: ../../includes/fundamentals/code-examples/Clothing.cs
604606 :start-after: start-model
@@ -616,7 +618,14 @@ The following code instantiates a ``Clothing`` object and inserts the document i
616618 Name = "Denim Jacket",
617619 InStock = false,
618620 Price = 32.99m,
619- ColorSelection = new List<string> { "dark wash", "light wash" }
621+ ColorSelection = new List<string> { "dark wash", "light wash" },
622+ ListedDate = DateTime.Parse("Jan 1, 2007"),
623+ SizeGuide = new Dictionary<string, string>()
624+ {
625+ {"Small", "Chest: 38\", Waist: 38\", Shoulders: 15\""},
626+ {"Medium", "Chest: 40\", Waist: 40\", Shoulders: 15.5\""},
627+ {"Large", "Chest: 42\", Waist: 40\", Shoulders: 16\""}
628+ }
620629 };
621630
622631 _myColl.InsertOne(doc);
@@ -631,7 +640,13 @@ The BSON representation of the inserted document looks like this:
631640 "name": "Denim Jacket",
632641 "inStock": false,
633642 "price": 32.99,
634- "colorSelection": [ "dark wash", "light wash" ]
643+ "colorSelection": [ "dark wash", "light wash" ],
644+ "listedDate" : ISODate("2007-01-01T00:00:00Z"),
645+ "sizeGuide" : {
646+ "Small" : "Chest: 38\", Waist: 38\", Shoulders: 15\"",
647+ "Medium" : "Chest: 40\", Waist: 40\", Shoulders: 15.5\"",
648+ "Large" : "Chest: 42\", Waist: 40\", Shoulders: 16\""
649+ }
635650 }
636651
637652Additional Information
0 commit comments