---
lang: en
title: 'API docs: repository.getkeyvalue'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/loopback-next/tree/master/packages/repository
permalink: /doc/en/lb4/apidocs.repository.getkeyvalue.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/repository](./repository.md) &gt; [getKeyValue](./repository.getkeyvalue.md)

## getKeyValue() function

Returns value of a keyName. Aims to resolve ObjectId problem of Mongo.

<b>Signature:</b>

```typescript
export declare function getKeyValue(model: AnyObject, keyName: string): unknown;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  model | [AnyObject](./repository.anyobject.md) | target model |
|  keyName | string | target key that gets the value from |

<b>Returns:</b>

unknown


