Skip to content

DOCSP-49647 - Clean up #653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
50 changes: 1 addition & 49 deletions source/crud/update-many.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,52 +124,4 @@ Update Many
:copyable: true
:dedent:
:start-after: // start-pipeline-async
:end-before: // end-pipeline-async

.. TODO: integrate into existing page

Sample Class
------------

The code examples in this guide demonstrate how you can use builders to
create types to interact with documents in the sample collection ``plants.flowers``.
Documents in this collection are modeled by the following ``Flower`` class:

.. literalinclude:: /includes/fundamentals/code-examples/builders.cs
:language: csharp
:dedent:
:start-after: start-model
:end-before: end-model

Each builder class takes a generic type parameter
``TDocument`` which represents the type of document that you are working
with. In this guide, the ``Flower`` class is the document type used in
each builder class example.

Define an Update
----------------

The ``UpdateDefinitionBuilder`` class provides a type-safe interface for
building up an update specification. Suppose you want to create an
update specification with the following criteria:

- Create the new field ``SunRequirement``
- Multiply the ``Price`` field value by 0.9

Use builders to create the update specification with the typed variant:

.. code-block:: csharp
:copyable: true

var builder = Builders<Flower>.Update;
var update = builder.Set(f => f.SunRequirement, "Full sun").Mul(f => f.Price, 0.9);

Alternatively, you can use string-based field names to define the update:

.. code-block:: csharp
:copyable: true

var builder = Builders<Flower>.Update;
var update = builder.Set("SunRequirement", "Full sun").Mul("Price", 0.9);

- `UpdateDefinitionBuilder <{+new-api-root+}/MongoDB.Driver/MongoDB.Driver.UpdateDefinitionBuilder-1.html>`__
:end-before: // end-pipeline-async
50 changes: 1 addition & 49 deletions source/crud/update-one.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,52 +112,4 @@ Update One
:copyable: true
:dedent:
:start-after: // start-pipeline-async
:end-before: // end-pipeline-async

.. TODO: integrate into existing page

Sample Class
------------

The code examples in this guide demonstrate how you can use builders to
create types to interact with documents in the sample collection ``plants.flowers``.
Documents in this collection are modeled by the following ``Flower`` class:

.. literalinclude:: /includes/fundamentals/code-examples/builders.cs
:language: csharp
:dedent:
:start-after: start-model
:end-before: end-model

Each builder class takes a generic type parameter
``TDocument`` which represents the type of document that you are working
with. In this guide, the ``Flower`` class is the document type used in
each builder class example.

Define an Update
----------------

The ``UpdateDefinitionBuilder`` class provides a type-safe interface for
building up an update specification. Suppose you want to create an
update specification with the following criteria:

- Create the new field ``SunRequirement``
- Multiply the ``Price`` field value by 0.9

Use builders to create the update specification with the typed variant:

.. code-block:: csharp
:copyable: true

var builder = Builders<Flower>.Update;
var update = builder.Set(f => f.SunRequirement, "Full sun").Mul(f => f.Price, 0.9);

Alternatively, you can use string-based field names to define the update:

.. code-block:: csharp
:copyable: true

var builder = Builders<Flower>.Update;
var update = builder.Set("SunRequirement", "Full sun").Mul("Price", 0.9);

- `UpdateDefinitionBuilder <{+new-api-root+}/MongoDB.Driver/MongoDB.Driver.UpdateDefinitionBuilder-1.html>`__
:end-before: // end-pipeline-async
2 changes: 0 additions & 2 deletions source/serialization.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ primitive types, collection types, and custom classes.
For a full list of available serializers, see the
`Serializers namespace API documentation <{+new-api-root+}/MongoDB.Bson/MongoDB.Bson.Serialization.Serializers.html>`__.

.. TODO: Revisit this page

.. _csharp-faq-object-serializer:

ObjectSerializer
Expand Down
Loading