30#ifndef MYSQLX_COLLECTION_CRUD_H
31#define MYSQLX_COLLECTION_CRUD_H
85PUBLIC_API common::Value Value::get<common::Value>() const;
103struct Collection_add_base
104 :
public Executable<Result, CollectionAdd>
136 :
public internal::Collection_add_base
137 , internal::Collection_add_detail
148 reset(internal::Crud_factory::mk_add(coll));
155 internal::Collection_add_base::operator=(other);
160 internal::Collection_add_base::operator=(std::move(other));
163 using internal::Collection_add_base::operator=;
170 template <
typename It>
174 do_add(get_impl(), begin, end);
187 template <
class Container>
191 do_add(get_impl(), c);
203 template <
typename... Types>
207 do_add(get_impl(), docs...);
215 using Impl = common::Collection_add_if;
219 return static_cast<Impl*
>(internal::Collection_add_base::get_impl());
237struct Collection_remove_cmd
241struct Collection_remove_base
242 :
public Sort< Limit< Bind_parameters< Collection_remove_cmd > > >
259 :
public internal::Collection_remove_base
274 reset(internal::Crud_factory::mk_remove(coll, expr));
282 internal::Collection_remove_cmd::operator=(other);
287 internal::Collection_remove_cmd::operator=(std::move(other));
290 using internal::Collection_remove_cmd::operator=;
306struct Collection_find_cmd
307 :
public Executable<DocResult, CollectionFind>
310struct Collection_find_base
311 :
public Group_by< Having< Sort< Limit< Offset< Bind_parameters<
312 Set_lock< Collection_find_cmd, common::Collection_find_if >
326 :
public internal::Collection_find_base
327 , internal::Collection_find_detail
330 using Operation = internal::Collection_find_base;
341 reset(internal::Crud_factory::mk_find(coll));
356 reset(internal::Crud_factory::mk_find(coll, expr));
364 internal::Collection_find_cmd::operator=(other);
369 internal::Collection_find_cmd::operator=(std::move(other));
372 using internal::Collection_find_cmd::operator=;
388 template <
typename... Expr>
392 get_impl()->clear_proj();
393 do_fields(get_impl(), proj...);
401 using Impl = common::Collection_find_if;
405 return static_cast<Impl*
>(internal::Collection_find_base::get_impl());
423class CollectionReplace;
425struct Collection_modify_cmd
429struct Collection_modify_base
430 :
public Sort< Limit< Bind_parameters< Collection_modify_cmd > > >
461 :
public internal::Collection_modify_base
476 reset(internal::Crud_factory::mk_modify(coll, expr));
484 internal::Collection_modify_cmd::operator=(other);
489 internal::Collection_modify_cmd::operator=(std::move(other));
492 using internal::Collection_modify_cmd::operator=;
505 get_impl()->add_operation(Impl::SET, field,
506 val.
get<common::Value>());
521 get_impl()->add_operation(Impl::UNSET, field);
537 get_impl()->add_operation(Impl::ARRAY_INSERT, field,
538 val.
get<common::Value>());
555 get_impl()->add_operation(Impl::ARRAY_APPEND, field,
556 val.
get<common::Value>());
583 get_impl()->add_operation(
584 Impl::MERGE_PATCH,
"$", (
const common::Value&)expr(val)
593 using Impl = common::Collection_modify_if;
597 return static_cast<Impl*
>(internal::Collection_modify_base::get_impl());
An operation which adds documents to a collection.
Definition: collection_crud.h:138
CollectionAdd & add(const Types &... docs)
Add document(s) to a collection.
Definition: collection_crud.h:204
CollectionAdd & add(const Container &c)
Add all documents within given container.
Definition: collection_crud.h:188
CollectionAdd(Collection &coll)
Create an empty add operation for the given collection.
Definition: collection_crud.h:145
CollectionAdd & add(const It &begin, const It &end)
Add all documents from a range defined by two iterators.
Definition: collection_crud.h:171
An operation which returns all or selected documents from a collection.
Definition: collection_crud.h:328
CollectionFind(Collection &coll)
Create an operation which returns all documents from the given collection.
Definition: collection_crud.h:338
CollectionFind(Collection &coll, const string &expr)
Create an operation which returns selected documents from the given collection.
Definition: collection_crud.h:353
Operation & fields(Expr... proj)
Specify a projection for the documents returned by this operation.
Definition: collection_crud.h:389
An operation which modifies all or selected documents in a collection.
Definition: collection_crud.h:462
CollectionModify & unset(const Field &field)
Remove the given field from a document.
Definition: collection_crud.h:518
CollectionModify & set(const Field &field, const Value &val)
Set the given field in a document to the given value.
Definition: collection_crud.h:502
CollectionModify & arrayAppend(const Field &field, const Value &val)
Append a value to an array field of a document.
Definition: collection_crud.h:552
CollectionModify(Collection &coll, const string &expr)
Create an operation which modifies selected documents in the given collection.
Definition: collection_crud.h:473
CollectionModify & arrayInsert(const Field &field, const Value &val)
Insert a value into an array field of a document.
Definition: collection_crud.h:534
CollectionModify & patch(const string &val)
Apply JSON Patch to a target JSON document.
Definition: collection_crud.h:580
An operation which removes documents from a collection.
Definition: collection_crud.h:260
CollectionRemove(Collection &coll, const string &expr)
Create an operation which removes selected documnets from the given collection.
Definition: collection_crud.h:271
Represents a collection of documents in a schema.
Definition: xdevapi.h:912
Represents an operation that can be executed.
Definition: executable.h:68
Value object can store value of scalar type, string, array or document.
Definition: document.h:230
T get() const
Return type of the value stored in this instance (or VNULL if no value is stored).
Details for public API classes representing CRUD operations.
Class representing executable statements.
Classes used to access query and command execution results.