# asc

## Call Signature

> **asc**\<`N`\>(`name`): [`OrderTerm`](https://stage.docs.arkiv.network/typescript-sdk/api-reference/main/interfaces/orderterm/)\<`OrderRef`\<`N`, `never`\>\>

Defined in: [src/query/order.ts:119](https://github.com/Arkiv-Network/arkiv-sdk-js/blob/d464c8dce16c3b8c472479ac5aae9d14344eb067/src/query/order.ts#L119)

Sorts by an attribute, smallest first, in the order values compare in — see
`ComparisonOperator`. Entities where the attribute is unset, or set with another type, come
first.

### Type Parameters

#### N

`N` *extends* `string`

### Parameters

#### name

`N`

An attribute of any type but bytes, indexed or not, or one of the system
attributes `$key`, `$owner`, `$creator` and `$expiresAt`.

### Returns

[`OrderTerm`](https://stage.docs.arkiv.network/typescript-sdk/api-reference/main/interfaces/orderterm/)\<`OrderRef`\<`N`, `never`\>\>

### Throws

If the name is outside the attribute name grammar.

### Throws

If the name starts with `$` but is not a queryable system
attribute, the type is bytes or not a type, or a system attribute is given another type.

### Example

```ts
asc("title")              // through a schema: title:str ASC
asc("score", "u256")      // without one: score:u256 ASC
asc("$expiresAt")         // $expiresAt:u64 ASC
```

## Call Signature

> **asc**\<`N`, `T`\>(`name`, `type`): [`OrderTerm`](https://stage.docs.arkiv.network/typescript-sdk/api-reference/main/interfaces/orderterm/)\<`OrderRef`\<`N`, `T`\>\>

Defined in: [src/query/order.ts:120](https://github.com/Arkiv-Network/arkiv-sdk-js/blob/d464c8dce16c3b8c472479ac5aae9d14344eb067/src/query/order.ts#L120)

Sorts by an attribute, smallest first, in the order values compare in — see
`ComparisonOperator`. Entities where the attribute is unset, or set with another type, come
first.

### Type Parameters

#### N

`N` *extends* `string`

#### T

`T` *extends* [`IndexableTypeTag`](https://stage.docs.arkiv.network/typescript-sdk/api-reference/main/type-aliases/indexabletypetag/)

### Parameters

#### name

`N`

An attribute of any type but bytes, indexed or not, or one of the system
attributes `$key`, `$owner`, `$creator` and `$expiresAt`.

#### type

`T`

The type to sort the attribute as. A system attribute's is fixed, and through a
schema it is the column's, so it is needed only for a query without one.

### Returns

[`OrderTerm`](https://stage.docs.arkiv.network/typescript-sdk/api-reference/main/interfaces/orderterm/)\<`OrderRef`\<`N`, `T`\>\>

### Throws

If the name is outside the attribute name grammar.

### Throws

If the name starts with `$` but is not a queryable system
attribute, the type is bytes or not a type, or a system attribute is given another type.

### Example

```ts
asc("title")              // through a schema: title:str ASC
asc("score", "u256")      // without one: score:u256 ASC
asc("$expiresAt")         // $expiresAt:u64 ASC
```