# ModelMapper

<div class="jsdoc-content"><header>
    
        <h2><span class="attribs"><span class="type-signature"></span></span>
            <span class="ancestors"><a href="index.html">mapping</a>~</span>ModelMapper<span class="signature">()</span><span class="type-signature"></span></h2>
        
            <div class="class-description"><p>Represents an object mapper for a specific model.</p></div>
        
    
</header>


    
        

    
    </div>

## Constructor

<div class="jsdoc-content">
    

    
    <h4 class="name" id="ModelMapper"><span class="type-signature"></span>new ModelMapper<span class="signature">()</span><span class="type-signature"></span></h4>
    

    















<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/mapping/model-mapper.js#L10" target="_blank" rel="noopener">mapping/model-mapper.js, line 10</a></p></div>




















    
    

    

    

    

    

    

    

    
        </div>

## Members

<div class="jsdoc-content">

        
            
<h4 class="name" id="batching"><span class="type-signature"></span>batching<span class="type-signature"> :ModelBatchMapper</span></h4>




<div class="description">
    <p>Gets a <a href="module-mapping-ModelBatchMapper.html">ModelBatchMapper</a> instance containing utility methods to group
multiple doc mutations in a single batch.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">ModelBatchMapper</span>


        </li>
    </ul>





<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/mapping/model-mapper.js#L25" target="_blank" rel="noopener">mapping/model-mapper.js, line 25</a></p></div>






        
            
<h4 class="name" id="name"><span class="type-signature"></span>name<span class="type-signature"> :String</span></h4>




<div class="description">
    <p>Gets the name identifier of the model.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">String</span>


        </li>
    </ul>





<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/mapping/model-mapper.js#L18" target="_blank" rel="noopener">mapping/model-mapper.js, line 18</a></p></div>






        
    

    
        </div>

## Methods

<div class="jsdoc-content">

        
            

    

    
    <h4 class="name" id="find"><span class="type-signature"></span>find<span class="signature">(doc, docInfo<span class="signature-attributes">opt</span>, executionOptions<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise&lt;Result>}</span></h4>
    

    



<div class="description">
    <p>Executes a SELECT query based on the filter and returns the result as an iterable of documents.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>doc</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            

            <td class="description last"><p>An object containing the properties that map to the primary keys to filter.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>docInfo</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An object containing the additional document information.</p>
                <h6>Properties</h6>
                

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>fields</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array&lt;String></span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An Array containing the name of the properties that will be used in the
SELECT cql statement generated, in order to restrict the amount of columns retrieved.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>orderBy</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object&lt;String, String></span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An associative array containing the column names as key and
the order string (asc or desc) as value used to set the order of the results server-side.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>limit</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>Restricts the result of the query to a maximum number of rows on the
server.</p></td>
        </tr>

    
    </tbody>
</table>

            </td>
        </tr>

    

        <tr>
            
                <td class="name"><code>executionOptions</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>
|

<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An object containing the options to be used for the requests
execution or a string representing the name of the execution profile.</p>
                <h6>Properties</h6>
                

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>executionProfile</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>The name of the execution profile.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>fetchSize</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>The amount of rows to retrieve per page.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>pageState</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>A Buffer instance or a string token representing the paging state.</p>
<p>When provided, the query will be executed starting from a given paging state.</p></td>
        </tr>

    
    </tbody>
</table>

            </td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/mapping/model-mapper.js#L85" target="_blank" rel="noopener">mapping/model-mapper.js, line 85</a></p></div>















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>A Promise that resolves to a <a href="Result.html">Result</a> instance.</p>
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Promise&lt;Result></span>


    </dd>
</dl>

    




    <h5>Examples</h5>
    
        <p class="code-caption">Get user's videos</p>
    
    <div class="highlight-javascript notranslate"><div class="highlight"><pre>const result = await videoMapper.find({ userId });
for (let video of result) {
  console.log(video.name);
}</pre></div></div>

        <p class="code-caption">Get user's videos from a certain date</p>
    
    <div class="highlight-javascript notranslate"><div class="highlight"><pre>videoMapper.find({ userId, addedDate: q.gte(date)});</pre></div></div>

        <p class="code-caption">Get user's videos in reverse order</p>
    
    <div class="highlight-javascript notranslate"><div class="highlight"><pre>videoMapper.find({ userId }, { orderBy: { addedDate: 'desc' }});</pre></div></div>



        
            

    

    
    <h4 class="name" id="findAll"><span class="type-signature"></span>findAll<span class="signature">(docInfo<span class="signature-attributes">opt</span>, executionOptions<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise&lt;Result>}</span></h4>
    

    



<div class="description">
    <p>Executes a SELECT query without a filter and returns the result as an iterable of documents.</p>
<p>This is only recommended to be used for tables with a limited amount of results. Otherwise, breaking up the
token ranges on the client side should be used.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>docInfo</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An object containing the additional document information.</p>
                <h6>Properties</h6>
                

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>fields</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array&lt;String></span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An Array containing the name of the properties that will be used in the
SELECT cql statement generated, in order to restrict the amount of columns retrieved.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>orderBy</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object&lt;String, String></span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An associative array containing the column names as key and
the order string (asc or desc) as value used to set the order of the results server-side.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>limit</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>Restricts the result of the query to a maximum number of rows on the
server.</p></td>
        </tr>

    
    </tbody>
</table>

            </td>
        </tr>

    

        <tr>
            
                <td class="name"><code>executionOptions</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>
|

<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An object containing the options to be used for the requests
execution or a string representing the name of the execution profile.</p>
                <h6>Properties</h6>
                

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>executionProfile</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>The name of the execution profile.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>fetchSize</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>The mount of rows to retrieve per page.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>pageState</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>A Buffer instance or a string token representing the paging state.</p>
<p>When provided, the query will be executed starting from a given paging state.</p></td>
        </tr>

    
    </tbody>
</table>

            </td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/mapping/model-mapper.js#L117" target="_blank" rel="noopener">mapping/model-mapper.js, line 117</a></p></div>















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>A Promise that resolves to a <a href="Result.html">Result</a> instance.</p>
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Promise&lt;Result></span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">(doc, docInfo<span class="signature-attributes">opt</span>, executionOptions<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise&lt;Object>}</span></h4>
    

    



<div class="description">
    <p>Gets the first document matching the provided filter or null when not found.</p>
<p>Note that all partition and clustering keys must be defined in order to use this method.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>doc</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            

            <td class="description last"><p>The object containing the properties that map to the primary keys.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>docInfo</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An object containing the additional document information.</p>
                <h6>Properties</h6>
                

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>fields</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array&lt;String></span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An Array containing the name of the properties that will be used in the
SELECT cql statement generated, in order to restrict the amount of columns retrieved.</p></td>
        </tr>

    
    </tbody>
</table>

            </td>
        </tr>

    

        <tr>
            
                <td class="name"><code>executionOptions</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>
|

<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An object containing the options to be used for the requests
execution or a string representing the name of the execution profile.</p>
                <h6>Properties</h6>
                

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>executionProfile</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>The name of the execution profile.</p></td>
        </tr>

    
    </tbody>
</table>

            </td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/mapping/model-mapper.js#L45" target="_blank" rel="noopener">mapping/model-mapper.js, line 45</a></p></div>















<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Promise&lt;Object></span>


    </dd>
</dl>

    




    <h5>Examples</h5>
    
        <p class="code-caption">Get a video by id</p>
    
    <div class="highlight-javascript notranslate"><div class="highlight"><pre>videoMapper.get({ id })</pre></div></div>

        <p class="code-caption">Get a video by id, selecting specific columns</p>
    
    <div class="highlight-javascript notranslate"><div class="highlight"><pre>videoMapper.get({ id }, fields: ['name', 'description'])</pre></div></div>



        
            

    

    
    <h4 class="name" id="insert"><span class="type-signature"></span>insert<span class="signature">(doc, docInfo<span class="signature-attributes">opt</span>, executionOptions<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise&lt;Result>}</span></h4>
    

    



<div class="description">
    <p>Inserts a document.</p>
<p>When the model is mapped to multiple tables, it will insert a row in each table when all the primary keys
are specified.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>doc</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            

            <td class="description last"><p>An object containing the properties to insert.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>docInfo</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An object containing the additional document information.</p>
                <h6>Properties</h6>
                

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>fields</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array&lt;String></span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An Array containing the name of the properties that will be used in the
INSERT cql statements generated. If specified, it must include the columns to insert and the primary keys.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>ttl</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>Specifies an optional Time To Live (in seconds) for the inserted values.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>ifNotExists</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>When set, it only inserts if the row does not exist prior to the insertion.</p>
<p>Please note that using IF NOT EXISTS will incur a non negligible performance cost so this should be used
sparingly.</p></td>
        </tr>

    
    </tbody>
</table>

            </td>
        </tr>

    

        <tr>
            
                <td class="name"><code>executionOptions</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>
|

<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An object containing the options to be used for the requests
execution or a string representing the name of the execution profile.</p>
                <h6>Properties</h6>
                

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>executionProfile</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>The name of the execution profile.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>isIdempotent</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>Defines whether the query can be applied multiple times without
changing the result beyond the initial application.</p>
<p>By default all generated INSERT statements are considered idempotent, except in the case of lightweight
transactions. Lightweight transactions at client level with transparent retries can
break linearizability. If that is not an issue for your application, you can manually set this field to true.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>timestamp</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>
|

<span class="param-type">Long</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>The default timestamp for the query in microseconds from the
unix epoch (00:00:00, January 1st, 1970).</p>
<p>When provided, this will replace the client generated and the server side assigned timestamp.</p></td>
        </tr>

    
    </tbody>
</table>

            </td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/mapping/model-mapper.js#L158" target="_blank" rel="noopener">mapping/model-mapper.js, line 158</a></p></div>















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>A Promise that resolves to a <a href="Result.html">Result</a> instance.</p>
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Promise&lt;Result></span>


    </dd>
</dl>

    




    <h5>Example</h5>
    
        <p class="code-caption">Insert a video</p>
    
    <div class="highlight-javascript notranslate"><div class="highlight"><pre>videoMapper.insert({ id, name });</pre></div></div>



        
            

    

    
    <h4 class="name" id="mapWithQuery"><span class="type-signature"></span>mapWithQuery<span class="signature">(query, paramsHandler, executionOptions<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {function}</span></h4>
    

    



<div class="description">
    <p>Uses the provided query and param getter function to execute a query and map the results.
Gets a function that takes the document, executes the query and returns the mapped results.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>query</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            

            <td class="description last"><p>The query to execute.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>paramsHandler</code></td>
            

            <td class="type">
            
                
<span class="param-type">function</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            

            <td class="description last"><p>The function to execute to extract the parameters of a document.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>executionOptions</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>
|

<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>When provided, the options for all executions generated with this
method will use the provided options and it will not consider the executionOptions per call.</p>
                <h6>Properties</h6>
                

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>executionProfile</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>The name of the execution profile.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>fetchSize</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>Amount of rows to retrieve per page.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>isIdempotent</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>Defines whether the query can be applied multiple times
without changing the result beyond the initial application.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>pageState</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>Buffer or string token representing the paging state.</p>
<p>When provided, the query will be executed starting from a given paging state.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>timestamp</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>
|

<span class="param-type">Long</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>The default timestamp for the query in microseconds from the
unix epoch (00:00:00, January 1st, 1970).</p>
<p>When provided, this will replace the client generated and the server side assigned timestamp.</p></td>
        </tr>

    
    </tbody>
</table>

            </td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/mapping/model-mapper.js#L289" target="_blank" rel="noopener">mapping/model-mapper.js, line 289</a></p></div>















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>Returns a function that takes the document and execution options as parameters and returns a
Promise the resolves to a <a href="Result.html">Result</a> instance.</p>
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">function</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="remove"><span class="type-signature"></span>remove<span class="signature">(doc, docInfo<span class="signature-attributes">opt</span>, executionOptions<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise&lt;Result>}</span></h4>
    

    



<div class="description">
    <p>Deletes a document.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>doc</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            

            <td class="description last"><p>A document containing the primary keys values of the document to delete.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>docInfo</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An object containing the additional doc information.</p>
                <h6>Properties</h6>
                

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>when</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>A document that act as the condition that has to be met for the DELETE to occur.
Use this property only in the case you want to specify a conditional clause for lightweight transactions (CAS).
When the CQL query is generated, this would be used to generate the <code>IF</code> clause.</p>
<p>Please note that using IF conditions will incur a non negligible performance cost on the server-side so this
should be used sparingly.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>ifExists</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>When set, it only issues the DELETE command if the row already exists on the
server.</p>
<p>Please note that using IF conditions will incur a non negligible performance cost on the server-side so this
should be used sparingly.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>fields</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array&lt;String></span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An Array containing the name of the properties that will be used in the
DELETE cql statement generated. If specified, it must include the columns to delete and the primary keys.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>deleteOnlyColumns</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>Determines that, when more document properties are specified
besides the primary keys, the generated DELETE statement should be used to delete some column values but leave
the row. When this is enabled and more properties are specified, a DELETE statement will have the following form:
&quot;DELETE col1, col2 FROM table1 WHERE pk1 = ? AND pk2 = ?&quot;</p></td>
        </tr>

    
    </tbody>
</table>

            </td>
        </tr>

    

        <tr>
            
                <td class="name"><code>executionOptions</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>
|

<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An object containing the options to be used for the requests
execution or a string representing the name of the execution profile.</p>
                <h6>Properties</h6>
                

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>executionProfile</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>The name of the execution profile.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>isIdempotent</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>Defines whether the query can be applied multiple times without
changing the result beyond the initial application.</p>
<p>By default all generated DELETE statements are considered idempotent, except in the case of lightweight
transactions. Lightweight transactions at client level with transparent retries can
break linearizability. If that is not an issue for your application, you can manually set this field to true.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>timestamp</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>
|

<span class="param-type">Long</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>The default timestamp for the query in microseconds from the
unix epoch (00:00:00, January 1st, 1970).</p>
<p>When provided, this will replace the client generated and the server side assigned timestamp.</p></td>
        </tr>

    
    </tbody>
</table>

            </td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/mapping/model-mapper.js#L257" target="_blank" rel="noopener">mapping/model-mapper.js, line 257</a></p></div>















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>A Promise that resolves to a <a href="Result.html">Result</a> instance.</p>
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Promise&lt;Result></span>


    </dd>
</dl>

    




    <h5>Example</h5>
    
        <p class="code-caption">Delete a video</p>
    
    <div class="highlight-javascript notranslate"><div class="highlight"><pre>videoMapper.remove({ id });</pre></div></div>



        
            

    

    
    <h4 class="name" id="update"><span class="type-signature"></span>update<span class="signature">(doc, docInfo<span class="signature-attributes">opt</span>, executionOptions<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise&lt;Result>}</span></h4>
    

    



<div class="description">
    <p>Updates a document.</p>
<p>When the model is mapped to multiple tables, it will update a row in each table when all the primary keys
are specified.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>doc</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            

            <td class="description last"><p>An object containing the properties to update.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>docInfo</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An object containing the additional document information.</p>
                <h6>Properties</h6>
                

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>fields</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array&lt;String></span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An Array containing the name of the properties that will be used in the
UPDATE cql statements generated. If specified, it must include the columns to update and the primary keys.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>ttl</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>Specifies an optional Time To Live (in seconds) for the inserted values.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>ifExists</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>When set, it only updates if the row already exists on the server.</p>
<p>Please note that using IF conditions will incur a non negligible performance cost on the server-side so this
should be used sparingly.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>when</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>A document that act as the condition that has to be met for the UPDATE to occur.
Use this property only in the case you want to specify a conditional clause for lightweight transactions (CAS).</p>
<p>Please note that using IF conditions will incur a non negligible performance cost on the server-side so this
should be used sparingly.</p></td>
        </tr>

    
    </tbody>
</table>

            </td>
        </tr>

    

        <tr>
            
                <td class="name"><code>executionOptions</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>
|

<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An object containing the options to be used for the requests
execution or a string representing the name of the execution profile.</p>
                <h6>Properties</h6>
                

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>executionProfile</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>The name of the execution profile.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>isIdempotent</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>Defines whether the query can be applied multiple times without
changing the result beyond the initial application.</p>
<p>The mapper uses the generated queries to determine the default value. When an UPDATE is generated with a
counter column or appending/prepending to a list column, the execution is marked as not idempotent.</p>
<p>Additionally, the mapper uses the safest approach for queries with lightweight transactions (Compare and
Set) by considering them as non-idempotent. Lightweight transactions at client level with transparent retries can
break linearizability. If that is not an issue for your application, you can manually set this field to true.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>timestamp</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>
|

<span class="param-type">Long</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>The default timestamp for the query in microseconds from the
unix epoch (00:00:00, January 1st, 1970).</p>
<p>When provided, this will replace the client generated and the server side assigned timestamp.</p></td>
        </tr>

    
    </tbody>
</table>

            </td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/mapping/model-mapper.js#L208" target="_blank" rel="noopener">mapping/model-mapper.js, line 208</a></p></div>















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>A Promise that resolves to a <a href="Result.html">Result</a> instance.</p>
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Promise&lt;Result></span>


    </dd>
</dl>

    




    <h5>Example</h5>
    
        <p class="code-caption">Update the name of a video</p>
    
    <div class="highlight-javascript notranslate"><div class="highlight"><pre>videoMapper.update({ id, name });</pre></div></div></div>
