Skip to main content

Create a record

Jump to the Code block for a combined complete example.


The following examples will use the setup and record structure below to illustrate single record creation in an Aerospike database.

The record structure:

Occurred: Integer  
Reported: Integer
Posted: Integer
Report: Map
shape: List,
summary: String,
city: String,
state: String,
duration: String
Location: GeoJSON


Write policies define additional semantics for the write operation. Instead of using the default write policies, we can set them on a per transaction basis.

The following example creates a new write policy container object that sets the send key policy to true. This stores the user defined key with the record, and returns it with read operations.


The key is a tuple made up of: (namespace, set, user defined key).

The following example creates a key using the sandbox namespace, ufodata set, and user defined key 5001.

Create a record

A record is the basic unit of storage in the database. A record is composed of: (key, metadata, bins).


Expand the block below to see the language specific creation of the variables used in the write example below.

View the language specific data creation


The following example shows the creation of the bins and the writing of the record to the database.

Code block

Expand this section for a single code block to create a record