How do I auto increase document ID with c lib?

You can use lcb_arithmetic with increment operation