# ListOperation usage

**URL:** <https://discuss.aerospike.com/t/listoperation-usage/4316>\
**Category:** Java Client\
**Tags:** list, java\
**Created:** [June 29, 2017, 10:49am UTC](https://discuss.aerospike.com/t/listoperation-usage/4316 "2017-06-29T10:49:46Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![waynenguyen](https://avatars.discourse-cdn.com/v4/letter/w/ed8c4c/32.png) [@waynenguyen](https://discuss.aerospike.com/u/waynenguyen)\
**Post date:** [June 29, 2017, 10:49am UTC](https://discuss.aerospike.com/t/listoperation-usage/4316/1 "2017-06-29T10:49:46Z")

</div>

Hi all,

I’m getting started with the ListOperation in the Java client, and the operations do not work as expected. Here are my code:

> ```
> AerospikeClient client = new AerospikeClient("10.0.0.1", 3000);
> Key key = new Key("test", "demo", "testlist");
> 
> ```

> ```
> Value vll = Value.get(123);
> 
> ```

> ```
> List<Value> itemList = new ArrayList<Value>();
> itemList.add(Value.get("s11"));
> itemList.add(Value.get("s22222"));
> Bin bin01 = new Bin("bin3", Value.get(itemList));
> 
> ```

> ```
> client.put(null, key, bin01);
> Record record0 = client.operate(null, key, Operation.put(new Bin("bin4", 90)), ListOperation.insertItems("bin6", 0, itemList) , Operation.get());
> System.out.println("record0");
> System.out.println(record0);
> Record record1 = client.operate(null, key, ListOperation.append("bin3", vll), Operation.get());
> System.out.println("record1");
> System.out.println(record1);
> 
> ```

> ```
> itemList.add(Value.get("s3333333"));
> itemList.add(Value.get("s4444444444"));
> itemList.add(Value.get("s5555555555555555"));
> Record record2 = client.operate(null, key,
> ListOperation.insertItems("bin3", 0, itemList), Operation.get()
> );
> System.out.println("record2");
> System.out.println(record2);
> 
> ```

> ```
> Record record3 = client.get(null, key);
> System.out.println("record3");
> System.out.println(record3);
> 
> ```

And here are the output:

> record0 (gen:2),(exp:239021264),(bins:(bin3:[s11, s22222]),(bin4:90)) record1 (gen:3),(exp:239021264),(bins:(bin3:[s11, s22222]),(bin4:90)) record2 (gen:4),(exp:239021265),(bins:(bin3:[s11, s22222]),(bin4:90)) record3 (gen:4),(exp:239021265),(bins:(bin3:[s11, s22222]),(bin4:90))

It seems that all of the ListOperations used in my code were not applied. Am I using it wrong?

Thanks.

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [June 29, 2017, 11:36pm UTC](https://discuss.aerospike.com/t/listoperation-usage/4316/2 "2017-06-29T23:36:42Z")

</div>

> [@waynenguyen](#):
>
> ListOperation.insertItems(“bin6”, 0, itemList) ,

Can you remove the ‘bin6’ operation and retry the rest of your code? Does not look like you are doing something obviously incorrect.

---

<div class="post-metadata">

**Author:** ![waynenguyen](https://avatars.discourse-cdn.com/v4/letter/w/ed8c4c/32.png) [@waynenguyen](https://discuss.aerospike.com/u/waynenguyen)\
**Post date:** [June 29, 2017, 11:44pm UTC](https://discuss.aerospike.com/t/listoperation-usage/4316/3 "2017-06-29T23:44:27Z")

</div>

> [@pgupta](#):
>
> ListOperation.insertItems(“bin6”, 0, itemList) ,

I’ve removed the line, the result is still the same.

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [June 29, 2017, 11:54pm UTC](https://discuss.aerospike.com/t/listoperation-usage/4316/4 "2017-06-29T23:54:34Z")

</div>

There is a bare bones example here: [aerospike-client-java/OperateList.java at master · aerospike/aerospike-client-java · GitHub](https://github.com/aerospike/aerospike-client-java/blob/master/examples/src/com/aerospike/examples/OperateList.java)

Can you reproduce that example?

---

<div class="post-metadata">

**Author:** ![waynenguyen](https://avatars.discourse-cdn.com/v4/letter/w/ed8c4c/32.png) [@waynenguyen](https://discuss.aerospike.com/u/waynenguyen)\
**Post date:** [June 30, 2017, 1:00am UTC](https://discuss.aerospike.com/t/listoperation-usage/4316/5 "2017-06-30T01:00:56Z")

</div>

Running the example yields the following:

> 2017-06-30 08:53:33 SGT INFO OperateList Begin 2017-06-30 08:53:33 SGT INFO CDT list functions are not supported by the connected Aerospike server. 2017-06-30 08:53:33 SGT INFO OperateList End

Here are the features available on the database (notice that CDT list is not avaiable)

> as\_msg;replicas-read;replicas-prole;replicas-write;replicas-master;cluster-generation;partition-info;partition-generation;udf

How do I enable CDT list on the Aerospike server? I couldn’t find any instructions on [http://www.aerospike.com/docs/guide/cdt-list.html](http://www.aerospike.com/docs/guide/cdt-list.html) or any related page.

Thanks.

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [June 30, 2017, 1:49am UTC](https://discuss.aerospike.com/t/listoperation-usage/4316/6 "2017-06-30T01:49:07Z")

</div>

What is your server version?

---

<div class="post-metadata">

**Author:** ![waynenguyen](https://avatars.discourse-cdn.com/v4/letter/w/ed8c4c/32.png) [@waynenguyen](https://discuss.aerospike.com/u/waynenguyen)\
**Post date:** [June 30, 2017, 1:51am UTC](https://discuss.aerospike.com/t/listoperation-usage/4316/7 "2017-06-30T01:51:35Z")

</div>

The server version is 3.3.21

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [June 30, 2017, 1:57am UTC](https://discuss.aerospike.com/t/listoperation-usage/4316/8 "2017-06-30T01:57:53Z")

</div>

Going through release notes, I believe list operations were introduced in 3.7.0.1 - [Aerospike Server CE Release Note | Download | Aerospike](http://www.aerospike.com/download/server/notes.html) and list-index in 3.8+ – so really you need to upgrade your server. See the release blog for 3.7 here: [Aerospike 3.7.0 Release | Aerospike](http://www.aerospike.com/blog/aerospike-3-7-0-release/)

---

<div class="post-metadata">

**Author:** ![waynenguyen](https://avatars.discourse-cdn.com/v4/letter/w/ed8c4c/32.png) [@waynenguyen](https://discuss.aerospike.com/u/waynenguyen)\
**Post date:** [June 30, 2017, 2:08am UTC](https://discuss.aerospike.com/t/listoperation-usage/4316/9 "2017-06-30T02:08:38Z")

</div>

Ah I see, thanks for your help!

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [June 30, 2017, 5:29am UTC](https://discuss.aerospike.com/t/listoperation-usage/4316/10 "2017-06-30T05:29:05Z")

</div>

Can you close the item on stackoverflow? Thanks.
