Skip to content

Commit

Permalink
(DOCSP-39838) Edited write landing page to include replace page.
Browse files Browse the repository at this point in the history
  • Loading branch information
your proper name committed Oct 16, 2024
1 parent c79c0f8 commit b434fd3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
7 changes: 7 additions & 0 deletions source/includes/usage-examples/write-code-examples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ int main() {
// end-update-multiple
}

{

// start-replace-one

// end-replace-one
}

{
// Deletes a document that matches the specified criteria
// start-delete-one
Expand Down
4 changes: 0 additions & 4 deletions source/includes/write/replace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ int main() {

// start-replace-options

auto query_filter = make_document(kvp("name", "Bagels N Buns"));
auto replace_doc = make_document(kvp("name", "2 Bagels 2 Buns"));

auto result = collection.replace_one(query_filter.view(), replace_doc.view());
// - bypass_document_validation ()
// - collation ()
// - upsert ()
Expand Down
17 changes: 14 additions & 3 deletions source/write.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Write Data to MongoDB

/write/insert
/write/update
/write/replace
/write/delete
/write/bulk-write

Expand Down Expand Up @@ -115,9 +116,19 @@ or editing a field:
To learn more about the ``update_many()`` method, see the
:ref:`Update Documents <cpp-write-update>` guide.

.. TODO:
Replace One
-----------
Replace One
-----------

The following code shows how to replace a single document in a collection:

.. literalinclude:: /includes/usage-examples/write-code-examples.cpp
:start-after: start-replace-one
:end-before: end-replace-one
:language: cpp
:dedent:

To learn more about the ``replace_one()`` method, see the
:ref:`Replace Documents <cpp-write-replace>` guide.

Delete One
----------
Expand Down

0 comments on commit b434fd3

Please sign in to comment.