1//
2// UpdateRequest.cpp
3//
4// Library: MongoDB
5// Package: MongoDB
6// Module: UpdateRequest
7//
8// Copyright (c) 2012, Applied Informatics Software Engineering GmbH.
9// and Contributors.
10//
11// SPDX-License-Identifier: BSL-1.0
12//
13
14
15#include "Poco/MongoDB/UpdateRequest.h"
16
17
18namespace Poco {
19namespace MongoDB {
20
21
22UpdateRequest::UpdateRequest(const std::string& collectionName, UpdateRequest::Flags flags):
23 RequestMessage(MessageHeader::OP_UPDATE),
24 _flags(flags),
25 _fullCollectionName(collectionName),
26 _selector(),
27 _update()
28{
29}
30
31
32UpdateRequest::~UpdateRequest()
33{
34}
35
36
37void UpdateRequest::buildRequest(BinaryWriter& writer)
38{
39 writer << 0; // 0 - reserved for future use
40 BSONWriter(writer).writeCString(_fullCollectionName);
41 writer << _flags;
42 _selector.write(writer);
43 _update.write(writer);
44}
45
46
47} } // namespace Poco::MongoDB
48