コード例 #1
0
void
mongoc_bulk_operation_update (mongoc_bulk_operation_t *bulk,
                              const bson_t *selector,
                              const bson_t *document,
                              bool upsert)
{
   bson_t opts;
   bson_error_t *error = &bulk->result.error;

   ENTRY;

   BULK_EXIT_IF_PRIOR_ERROR;

   bson_init (&opts);
   if (upsert) {
      BSON_APPEND_BOOL (&opts, "upsert", upsert);
   }

   mongoc_bulk_operation_update_many_with_opts (
      bulk, selector, document, &opts, error);

   bson_destroy (&opts);

   if (error->domain) {
      MONGOC_WARNING ("%s", error->message);
   }

   EXIT;
}
コード例 #2
0
static bool
bulk_update_many (mongoc_bulk_operation_t *bulk,
                  bson_error_t *error,
                  bson_t *cmd)
{
   BSON_APPEND_UTF8 (cmd, "update", "collection");
   return mongoc_bulk_operation_update_many_with_opts (
      bulk, tmp_bson ("{}"), tmp_bson ("{}"), NULL, error);
}