# Multiple operation: documentation clarification

**URL:** <https://discuss.aerospike.com/t/multiple-operation-documentation-clarification/5629>\
**Category:** C Client Library\
**Created:** [October 30, 2018, 9:32am UTC](https://discuss.aerospike.com/t/multiple-operation-documentation-clarification/5629 "2018-10-30T09:32:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![manana](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@manana](https://discuss.aerospike.com/u/manana)\
**Post date:** [October 30, 2018, 9:32am UTC](https://discuss.aerospike.com/t/multiple-operation-documentation-clarification/5629/1 "2018-10-30T09:32:18Z")

</div>

Hi, the documentation states following ([https://www.aerospike.com/docs/client/c/usage/kvs/multiops.html](https://www.aerospike.com/docs/client/c/usage/kvs/multiops.html)):

> Read operations are performed after all other operations complete. The non-read operation order is defined by the application.

However, take a look into this code (modified map example), that performs 3 operations (read, map\_increment, read):

```
int
main(int argc, char* argv[])
{
    // Parse command line arguments.
    if (! example_get_opts(argc, argv, EXAMPLE_BASIC_OPTS)) {
        exit(-1);
    }
    
    // Connect to the aerospike database cluster.
    aerospike as;
    example_connect_to_aerospike(&as);
    
    // Start clean.
    example_remove_test_record(&as);
    
    // Create hashmap of scores.
    as_hashmap scores;
    as_hashmap_init(&scores, 2);
    as_string mkey1;
    as_integer mval1;
    as_string_init(&mkey1, "Bob", false);
    as_integer_init(&mval1, 1);
    as_hashmap_set(&scores, (as_val*)&mkey1, (as_val*)&mval1);
    as_string mkey2;
    as_integer mval2;
    as_string_init(&mkey2, "Jim", false);
    as_integer_init(&mval2, 1);
    as_hashmap_set(&scores, (as_val*)&mkey2, (as_val*)&mval2);
    
    // Write scores to server.
    as_map_policy map_policy;
    as_map_policy_init(&map_policy);

    as_operations ops;
    as_operations_inita(&ops, 1);
    as_operations_add_map_put_items(&ops, map_bin_name, &map_policy, (as_map*)&scores);
    
    as_error err;
    as_record* rec = NULL;
    if (aerospike_key_operate(&as, &err, NULL, &g_key, &ops, &rec) != AEROSPIKE_OK) {
        LOG("aerospike_key_operate() returned %d - %s", err.code, err.message);
        example_cleanup(&as);
        exit(-1);
    }
    as_operations_destroy(&ops);
    as_record_destroy(rec);
    
    as_operations_inita(&ops, 3);

    as_operations_add_read(&ops, map_bin_name);
    
    as_string_init(&mkey1, "Bob", false);
    as_integer_init(&mval1, 1);
    as_operations_add_map_increment(&ops, map_bin_name, &map_policy, (as_val*)&mkey1, (as_val*)&mval1);

    as_operations_add_read(&ops, map_bin_name);

    rec = NULL;
    if (aerospike_key_operate(&as, &err, NULL, &g_key, &ops, &rec) != AEROSPIKE_OK) {
        LOG("aerospike_key_operate() returned %d - %s", err.code, err.message);
        example_cleanup(&as);
        exit(-1);
    }
    as_operations_destroy(&ops);

    as_record_iterator it;
    as_record_iterator_init(&it, rec);

    example_dump_record(rec);

    as_record_destroy(rec);

    // Cleanup and disconnect from the database cluster.
    example_cleanup(&as);
    LOG("map example successfully completed");
    return 0;
}

```

The operate function returns following results:

```
generation 2, ttl 2591492, 3 bins:
mapbin : {"Jim":1, "Bob":1}
mapbin : 2
mapbin : {"Jim":1, "Bob":2}

```

That’s a record with 3 bins, that are named “mabin” (all of them) with different types (MAP, INTEGER, MAP) that correspond (???) with added operation. I’ve took a look into other clients and it looks like this behavior is special for c client. Other clients returns record as ‘map-like’ object with unique ‘keys’.

I’ve found only one mention in the map example in following comment:

```
// Operations are returned in same order they are added. Since there is only one operation in
// the aerospike_key_operate() call, the results are located in the first returned bin.

```

Could you please clarify and complete the documentation [https://www.aerospike.com/docs/client/c/usage/kvs/multiops.html](https://www.aerospike.com/docs/client/c/usage/kvs/multiops.html), [C Client API: Key Operations](https://www.aerospike.com/apidocs/c/d2/d56/group __key__ operations.html#ga03b95db50729304d290b17ec2f5e5767)?

Thanks!

---

<div class="post-metadata">

**Author:** ![Brian](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/brian/32/2211_2.png) [@Brian](https://discuss.aerospike.com/u/Brian)\
**Post date:** [October 30, 2018, 5:19pm UTC](https://discuss.aerospike.com/t/multiple-operation-documentation-clarification/5629/2 "2018-10-30T17:19:01Z")

</div>

_Read operations are performed after all other operations complete. The non-read operation order is defined by the application._

This documentation is wrong. Operations are perform in-order regardless of read or write operation since version 3.6. We will fix.

---

<div class="post-metadata">

**Author:** ![manana](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@manana](https://discuss.aerospike.com/u/manana)\
**Post date:** [October 31, 2018, 9:39am UTC](https://discuss.aerospike.com/t/multiple-operation-documentation-clarification/5629/3 "2018-10-31T09:39:11Z")

</div>

Thanks, maybe little more description about returned record from as\_key\_operate would be worth it. Because a single comment line in an example is more descriptive then the documentation.

I have intuitively thought about a record like about some kind of a map (serialized to an array) - but it’s more like a multi-map (more bins with the same name are contained in a record). (And I’m not able to find anything about it in the documentation.)

---

<div class="post-metadata">

**Author:** ![Brian](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/brian/32/2211_2.png) [@Brian](https://discuss.aerospike.com/u/Brian)\
**Post date:** [November 9, 2018, 12:23am UTC](https://discuss.aerospike.com/t/multiple-operation-documentation-clarification/5629/4 "2018-11-09T00:23:40Z")

</div>

Documentation has been updated.

[https://www.aerospike.com/docs/client/c/usage/kvs/multiops.html](https://www.aerospike.com/docs/client/c/usage/kvs/multiops.html)
