http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4a92ab09/content/docs/data-queries/querying-your-data.html ---------------------------------------------------------------------- diff --git a/content/docs/data-queries/querying-your-data.html b/content/docs/data-queries/querying-your-data.html new file mode 100644 index 0000000..6a618a1 --- /dev/null +++ b/content/docs/data-queries/querying-your-data.html @@ -0,0 +1,453 @@ + + +<!DOCTYPE html> +<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> +<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> +<head> + <meta charset="utf-8"> + + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + + <title>Querying your data — Apache Usergrid 1.0 documentation</title> + + + + + + + + + + + + + + + + <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> + + + + + + <link rel="top" title="Apache Usergrid 1.0 documentation" href="../index.html"/> + <link rel="next" title="Query parameters & clauses" href="query-parameters.html"/> + <link rel="prev" title="Entities" href="../data-storage/entities.html"/> + + + <script src="../_static/js/modernizr.min.js"></script> + +</head> + +<body class="wy-body-for-nav" role="document"> + + <div class="wy-grid-for-nav"> + + + <nav data-toggle="wy-nav-shift" class="wy-nav-side"> + <div class="wy-side-nav-search"> + + + + <a href="../index.html" class="icon icon-home"> Apache Usergrid + + + + </a> + + + + + <div class="version"> + 1.0 + </div> + + + + +<div role="search"> + <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> + <input type="text" name="q" placeholder="Search docs" /> + <input type="hidden" name="check_keywords" value="yes" /> + <input type="hidden" name="area" value="default" /> + </form> +</div> + + + </div> + + <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> + + + + <p class="caption"><span class="caption-text">Introduction</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../introduction/usergrid-features.html">Usergrid Features</a></li> +<li class="toctree-l1"><a class="reference internal" href="../introduction/data-model.html">Usergrid Data model</a></li> +<li class="toctree-l1"><a class="reference internal" href="../introduction/async-vs-sync.html">Async vs. sync calls</a></li> +</ul> +<p class="caption"><span class="caption-text">Getting Started</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/creating-a-new-application.html">Creating a new application</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/creating-account.html">Creating an Usergrid Account</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/using-a-sandbox-app.html">Using a Sandbox Application</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/using-the-api.html">Using the API</a></li> +</ul> +<p class="caption"><span class="caption-text">Data Storage</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../data-storage/data-store-dbms.html">The Usergrid Data Store</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-storage/optimizing-access.html">Data Store Best Practices</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-storage/collections.html">Collections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-storage/entities.html">Entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Data Queries</span></p> +<ul class="current"> +<li class="toctree-l1 current"><a class="current reference internal" href="">Querying your data</a><ul> +<li class="toctree-l2"><a class="reference internal" href="#basic-query-usage">Basic query usage</a><ul> +<li class="toctree-l3"><a class="reference internal" href="#request-syntax">Request Syntax</a></li> +<li class="toctree-l3"><a class="reference internal" href="#retrieving-values-for-multiple-properties">Retrieving values for multiple properties</a></li> +<li class="toctree-l3"><a class="reference internal" href="#response-syntax">Response syntax</a></li> +</ul> +</li> +</ul> +</li> +<li class="toctree-l1"><a class="reference internal" href="query-parameters.html">Query parameters & clauses</a></li> +<li class="toctree-l1"><a class="reference internal" href="operators-and-types.html">Query operators & data types</a></li> +<li class="toctree-l1"><a class="reference internal" href="advanced-query-usage.html">Advanced query usage</a></li> +</ul> +<p class="caption"><span class="caption-text">Entity Connections</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/connecting-entities.html">Connecting entities</a></li> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/retrieving-entities.html">Retrieving connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/disconnecting-entities.html">Disconnecting entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Security & Authentication</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/app-security.html">Security & token authentication</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/using-permissions.html">Using permissions</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/authenticating-users-and-application-clients.html">Authenticating users & app clients</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/user-authentication-types.html">Authentication levels</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/changing-token-time-live-ttl.html">Changing token expiration (time-to-live)</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/authenticating-api-requests.html">Authenticating API requests</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/revoking-tokens-logout.html">Revoking tokens (logout)</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/facebook-sign.html">Facebook sign in</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/securing-your-app.html">Security best practices</a></li> +</ul> +<p class="caption"><span class="caption-text">User Management & Social Graph</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-management.html">User management & social graph</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/working-user-data.html">Working with User Data</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/group.html">Working with group data</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/activity.html">Activity</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-connections.html">Social Graph Connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-connections.html#creating-other-connections">Creating other connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/messagee-example.html">App Example - Messagee</a></li> +</ul> +<p class="caption"><span class="caption-text">Geo-location</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../geolocation/geolocation.html">Geolocating your Entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Assets & Files</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/uploading-assets.html">Uploading assets</a></li> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/retrieving-assets.html">Retrieving assets</a></li> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/folders.html">Folders</a></li> +</ul> +<p class="caption"><span class="caption-text">Counters & Events</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/events-and-counters.html">Counters & events</a></li> +<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html">Creating & incrementing counters</a></li> +<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html#decrementing-resetting-counters">Decrementing/resetting counters</a></li> +<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html#using-counters-hierarchically">Using counters hierarchically</a></li> +<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/retrieving-counters.html">Retrieving counters</a></li> +</ul> +<p class="caption"><span class="caption-text">Organizations & Applications</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/managing.html">Organization & application management</a></li> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/organization.html">Organization</a></li> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/application.html">Application</a></li> +</ul> +<p class="caption"><span class="caption-text">API Reference</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html">Methods</a></li> +<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html#models">Models</a></li> +</ul> +<p class="caption"><span class="caption-text">Client SDKs</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../sdks/tbd.html">COMING SOON...</a></li> +</ul> +<p class="caption"><span class="caption-text">Installing the Stack</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug1-deploy-to-tomcat.html">Usegrid 1: Deploying to Tomcat</a></li> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug1-launcher-quick-start.html">Usegrid 1: Launcher Quick-start</a></li> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug2-deploy-to-tomcat.html">Usergrid 2: Deploy to Tomcat</a></li> +</ul> +<p class="caption"><span class="caption-text">More about Usergrid</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../reference/presos-and-videos.html">Presentations & Videos</a></li> +<li class="toctree-l1"><a class="reference internal" href="../reference/contribute-code.html">How to Contribute Code & Docs</a></li> +</ul> + + + + </div> + + </nav> + + <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> + + + <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> + <i data-toggle="wy-nav-top" class="fa fa-bars"></i> + <a href="../index.html">Apache Usergrid</a> + </nav> + + + + <div class="wy-nav-content"> + <div class="rst-content"> + <div role="navigation" aria-label="breadcrumbs navigation"> + <ul class="wy-breadcrumbs"> + <li><a href="../index.html">Docs</a> »</li> + + <li>Querying your data</li> + <li class="wy-breadcrumbs-aside"> + + + <a href="../_sources/data-queries/querying-your-data.txt" rel="nofollow"> View page source</a> + + + </li> + </ul> + <hr/> +</div> + <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> + <div itemprop="articleBody"> + + <div class="section" id="querying-your-data"> +<h1>Querying your data<a class="headerlink" href="#querying-your-data" title="Permalink to this headline">¶</a></h1> +<p>This article describes how to use queries to filter data retrieved from +your backend data store. Queries allow you to work with only the data +you need, making your app more efficient and manageable by reducing the +number of entities returned or acted on by the API. A query can be sent +with any GET, PUT or DELETE request. For example, you might query the +API to retrieve only the user entities with the property status:’active’ +to get a list of your users that have active accounts.</p> +<p>For information on more advanced query usage and syntax, see <a class="reference external" href="query-parameters.html">Query +parameters & clauses</a>.</p> +<div class="admonition note"> <p class="first admonition-title"><p>Note</p> + </p> <p class="last"> + + +Query examples in this content are shown unencoded to make them easier<p>to read. Keep in mind that you might need to encode query strings if +you’re sending them as part of URLs, such as when you’re executing them +with the cURL tool.</p> +</p></div><div class="section" id="basic-query-usage"> +<h2>Basic query usage<a class="headerlink" href="#basic-query-usage" title="Permalink to this headline">¶</a></h2> +<p>The following examples show how to query the Usergrid API to return the +first 5 entities in the users collection that contain the property +status:’active’.</p> +<div class="admonition note"> <p class="first admonition-title"><p>Note</p> + </p> <p class="last"> + + +Optimizing queries: As a best practice, you should include no more<p>than 3 parameters in your queries. The API will not prevent you from +submitting a query with more than 3 parameters; however, due to the +nature of NoSQL, queries with many parameters can quickly become very +inefficient.</p> +</p></div><p>For more information, see our <a class="reference external" href="../data-store/data-storage-dbms.html">Usergrid DBMS +overview</a> and <a class="reference external" href="../data-storage/optimizing-access">Data store best +practices</a>.</p> +<div class="section" id="request-syntax"> +<h3>Request Syntax<a class="headerlink" href="#request-syntax" title="Permalink to this headline">¶</a></h3> +<div class="highlight-python"><div class="highlight"><pre>https://api.usergrid.com/<org>/<app>/<collection>?ql=<query_statement> +</pre></div> +</div> +<p>Note: Any values specified in the query statement should be enclosed in +single-quotes.</p> +<div class="highlight-python"><div class="highlight"><pre>https://api.usergrid.com/your-org/your-app/users?limit=5&ql=select * where status = 'active' +</pre></div> +</div> +<p>Alternatively, when you use a statement that starts select * where you +can omit the first part of the statement and abbreviate it this way:</p> +<div class="highlight-python"><div class="highlight"><pre>https://api.usergrid.com/your-org/your-app/users?limit=5&ql=status = 'active' +</pre></div> +</div> +</div> +<div class="section" id="retrieving-values-for-multiple-properties"> +<h3>Retrieving values for multiple properties<a class="headerlink" href="#retrieving-values-for-multiple-properties" title="Permalink to this headline">¶</a></h3> +<p>Your query can return multiple kinds of values – such as the values of +multiple properties – by specifying the property names in your select +statement as a comma-separated list.</p> +<p>For example, the following request returns the address and phone number +of users whose name is Gladys Kravitz:</p> +<div class="highlight-python"><div class="highlight"><pre>/users?ql=select address,phone_number where name = 'Gladys Kravitz' +</pre></div> +</div> +</div> +<div class="section" id="response-syntax"> +<h3>Response syntax<a class="headerlink" href="#response-syntax" title="Permalink to this headline">¶</a></h3> +<p>When you query your data, the API response is formatted in JavaScript +Object Notation (JSON). This is a common format used for parameter and +return values in REST web services.</p> +<p>Data corresponding to the response is captured in the responseâs +entities array. The array will include one JSON-object for each entity +returned for the query. Each returned entity will include a number of +default properties, including the UUID of the entity, the entity type, +and values for properties such as name, username, email, and so on. For +a complete list of default properties by entity type, see Default Data +Entity Types.</p> +<p>For example, the following query for all entities of type user where the +name property equals ‘Gladys Kravitz’:</p> +<div class="highlight-python"><div class="highlight"><pre>/users?ql=select * where name = âGladys Kravitzâ +</pre></div> +</div> +<p>will return the following response:</p> +<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span> + <span class="s">"action"</span> <span class="p">:</span> <span class="s">"get"</span><span class="p">,</span> + <span class="s">"application"</span> <span class="p">:</span> <span class="s">"8272c9b0-d86a-11e2-92e2-cdf1ce04c1c0"</span><span class="p">,</span> + <span class="s">"params"</span> <span class="p">:</span> <span class="p">{</span> + <span class="s">"ql"</span> <span class="p">:</span> <span class="p">[</span> <span class="s">"select * where name = 'Gladys Kravitz'"</span> <span class="p">]</span> + <span class="p">},</span> + <span class="s">"path"</span> <span class="p">:</span> <span class="s">"/users"</span><span class="p">,</span> + <span class="s">"uri"</span> <span class="p">:</span> <span class="s">"http://api.usergrid.com/myorg/myapp/users"</span><span class="p">,</span> + <span class="s">"entities"</span> <span class="p">:</span> <span class="p">[</span> <span class="p">{</span> + <span class="s">"uuid"</span> <span class="p">:</span> <span class="s">"d0d7d0ba-e97b-11e2-8cef-411c466c4f2c"</span><span class="p">,</span> + <span class="s">"type"</span> <span class="p">:</span> <span class="s">"user"</span><span class="p">,</span> + <span class="s">"name"</span> <span class="p">:</span> <span class="s">"Gladys Kravitz"</span><span class="p">,</span> + <span class="s">"created"</span> <span class="p">:</span> <span class="mi">1373472876859</span><span class="p">,</span> + <span class="s">"modified"</span> <span class="p">:</span> <span class="mi">1373472876859</span><span class="p">,</span> + <span class="s">"username"</span> <span class="p">:</span> <span class="s">"gladys"</span><span class="p">,</span> + <span class="s">"email"</span> <span class="p">:</span> <span class="s">"gla...@example.com"</span><span class="p">,</span> + <span class="s">"activated"</span> <span class="p">:</span> <span class="n">true</span><span class="p">,</span> + <span class="s">"picture"</span> <span class="p">:</span> <span class="s">"http://www.gravatar.com/avatar/20c57d4f41cf51f2db44165eb058b3b2"</span><span class="p">,</span> + <span class="s">"metadata"</span> <span class="p">:</span> <span class="p">{</span> + <span class="s">"path"</span> <span class="p">:</span> <span class="s">"/users/d0d7d0ba-e97b-11e2-8cef-411c466c4f2c"</span><span class="p">,</span> + <span class="s">"sets"</span> <span class="p">:</span> <span class="p">{</span> + <span class="s">"rolenames"</span> <span class="p">:</span> <span class="s">"/users/d0d7d0ba-e97b-11e2-8cef-411c466c4f2c/rolenames"</span><span class="p">,</span> + <span class="s">"permissions"</span> <span class="p">:</span> <span class="s">"/users/d0d7d0ba-e97b-11e2-8cef-411c466c4f2c/permissions"</span> + <span class="p">},</span> + <span class="s">"connections"</span> <span class="p">:</span> <span class="p">{</span> + <span class="s">"firstname"</span> <span class="p">:</span> <span class="s">"/users/d0d7d0ba-e97b-11e2-8cef-411c466c4f2c/firstname"</span><span class="p">,</span> + <span class="s">"lastname"</span> <span class="p">:</span> <span class="s">"/users/d0d7d0ba-e97b-11e2-8cef-411c466c4f2c/lastname"</span> + <span class="p">},</span> + <span class="s">"collections"</span> <span class="p">:</span> <span class="p">{</span> + <span class="s">"activities"</span> <span class="p">:</span> <span class="s">"/users/d0d7d0ba-e97b-11e2-8cef-411c466c4f2c/activities"</span><span class="p">,</span> + <span class="s">"users"</span> <span class="p">:</span> <span class="s">"/users/d0d7d0ba-e97b-11e2-8cef-411c466c4f2c/users"</span><span class="p">,</span> + <span class="s">"feed"</span> <span class="p">:</span> <span class="s">"/users/d0d7d0ba-e97b-11e2-8cef-411c466c4f2c/feed"</span><span class="p">,</span> + <span class="s">"groups"</span> <span class="p">:</span> <span class="s">"/users/d0d7d0ba-e97b-11e2-8cef-411c466c4f2c/groups"</span><span class="p">,</span> + <span class="s">"roles"</span> <span class="p">:</span> <span class="s">"/users/d0d7d0ba-e97b-11e2-8cef-411c466c4f2c/roles"</span><span class="p">,</span> + <span class="s">"following"</span> <span class="p">:</span> <span class="s">"/users/d0d7d0ba-e97b-11e2-8cef-411c466c4f2c/following"</span><span class="p">,</span> + <span class="s">"followers"</span> <span class="p">:</span> <span class="s">"/users/d0d7d0ba-e97b-11e2-8cef-411c466c4f2c/followers"</span> + <span class="p">}</span> + <span class="p">}</span> + <span class="p">}</span> <span class="p">],</span> + <span class="s">"timestamp"</span> <span class="p">:</span> <span class="mi">1374694196061</span><span class="p">,</span> + <span class="s">"duration"</span> <span class="p">:</span> <span class="mi">48</span><span class="p">,</span> + <span class="s">"organization"</span> <span class="p">:</span> <span class="s">"myorg"</span><span class="p">,</span> + <span class="s">"applicationName"</span> <span class="p">:</span> <span class="s">"myapp"</span><span class="p">,</span> + <span class="s">"count"</span> <span class="p">:</span> <span class="mi">1</span> +<span class="p">}</span> +</pre></div> +</div> +<p>Compare the preceding example with the following for another kind of +query. Imagine the following request string, where the query string is +asking for only the values of two of the entityâs properties (username +and name):</p> +<div class="highlight-python"><div class="highlight"><pre>/users?ql=select username,name where name=âGladys Kravitzâ +</pre></div> +</div> +<p>In the response JSON from this query, the return value is specified as +the property of the list item – here, an array containing only the +values of the properties the query asked for, in the order they were +requested (username first, then name).</p> +<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span> + <span class="s">"action"</span> <span class="p">:</span> <span class="s">"get"</span><span class="p">,</span> + <span class="s">"application"</span> <span class="p">:</span> <span class="s">"8272c9b0-d86a-11e2-92e2-cdf1ce04c1c0"</span><span class="p">,</span> + <span class="s">"params"</span> <span class="p">:</span> <span class="p">{</span> + <span class="s">"ql"</span> <span class="p">:</span> <span class="p">[</span> <span class="s">"select username,name where name='Gladys Kravitz'"</span> <span class="p">]</span> + <span class="p">},</span> + <span class="s">"path"</span> <span class="p">:</span> <span class="s">"/users"</span><span class="p">,</span> + <span class="s">"uri"</span> <span class="p">:</span> <span class="s">"http://api.usergrid.com/myorg/myapp/users"</span><span class="p">,</span> + <span class="s">"list"</span> <span class="p">:</span> <span class="p">[</span> <span class="p">[</span> <span class="s">"gladys"</span><span class="p">,</span> <span class="s">"Gladys Kravitz"</span> <span class="p">]</span> <span class="p">],</span> + <span class="s">"timestamp"</span> <span class="p">:</span> <span class="mi">1374697463190</span><span class="p">,</span> + <span class="s">"duration"</span> <span class="p">:</span> <span class="mi">25</span><span class="p">,</span> + <span class="s">"organization"</span> <span class="p">:</span> <span class="s">"myorg"</span><span class="p">,</span> + <span class="s">"applicationName"</span> <span class="p">:</span> <span class="s">"myapp"</span><span class="p">,</span> + <span class="s">"count"</span> <span class="p">:</span> <span class="mi">1</span> +<span class="p">}</span> +</pre></div> +</div> +</div> +</div> +</div> + + + </div> + </div> + <footer> + + <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> + + <a href="query-parameters.html" class="btn btn-neutral float-right" title="Query parameters & clauses" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a> + + + <a href="../data-storage/entities.html" class="btn btn-neutral" title="Entities" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a> + + </div> + + + <hr/> + + <div role="contentinfo"> + <p> + © Copyright 2013-2015, Apache Usergrid. + + </p> + </div> + Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. + +</footer> + + </div> + </div> + + </section> + + </div> + + + + + + <script type="text/javascript"> + var DOCUMENTATION_OPTIONS = { + URL_ROOT:'../', + VERSION:'1.0', + COLLAPSE_INDEX:false, + FILE_SUFFIX:'.html', + HAS_SOURCE: true + }; + </script> + <script type="text/javascript" src="../_static/jquery.js"></script> + <script type="text/javascript" src="../_static/underscore.js"></script> + <script type="text/javascript" src="../_static/doctools.js"></script> + + + + + + <script type="text/javascript" src="../_static/js/theme.js"></script> + + + + + <script type="text/javascript"> + jQuery(function () { + SphinxRtdTheme.StickyNav.enable(); + }); + </script> + + +</body> +</html> \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4a92ab09/content/docs/data-storage/collections.html ---------------------------------------------------------------------- diff --git a/content/docs/data-storage/collections.html b/content/docs/data-storage/collections.html new file mode 100644 index 0000000..ef51089 --- /dev/null +++ b/content/docs/data-storage/collections.html @@ -0,0 +1,670 @@ + + +<!DOCTYPE html> +<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> +<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> +<head> + <meta charset="utf-8"> + + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + + <title>Collections — Apache Usergrid 1.0 documentation</title> + + + + + + + + + + + + + + + + <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> + + + + + + <link rel="top" title="Apache Usergrid 1.0 documentation" href="../index.html"/> + <link rel="next" title="Entities" href="entities.html"/> + <link rel="prev" title="Data Store Best Practices" href="optimizing-access.html"/> + + + <script src="../_static/js/modernizr.min.js"></script> + +</head> + +<body class="wy-body-for-nav" role="document"> + + <div class="wy-grid-for-nav"> + + + <nav data-toggle="wy-nav-shift" class="wy-nav-side"> + <div class="wy-side-nav-search"> + + + + <a href="../index.html" class="icon icon-home"> Apache Usergrid + + + + </a> + + + + + <div class="version"> + 1.0 + </div> + + + + +<div role="search"> + <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> + <input type="text" name="q" placeholder="Search docs" /> + <input type="hidden" name="check_keywords" value="yes" /> + <input type="hidden" name="area" value="default" /> + </form> +</div> + + + </div> + + <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> + + + + <p class="caption"><span class="caption-text">Introduction</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../introduction/usergrid-features.html">Usergrid Features</a></li> +<li class="toctree-l1"><a class="reference internal" href="../introduction/data-model.html">Usergrid Data model</a></li> +<li class="toctree-l1"><a class="reference internal" href="../introduction/async-vs-sync.html">Async vs. sync calls</a></li> +</ul> +<p class="caption"><span class="caption-text">Getting Started</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/creating-a-new-application.html">Creating a new application</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/creating-account.html">Creating an Usergrid Account</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/using-a-sandbox-app.html">Using a Sandbox Application</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/using-the-api.html">Using the API</a></li> +</ul> +<p class="caption"><span class="caption-text">Data Storage</span></p> +<ul class="current"> +<li class="toctree-l1"><a class="reference internal" href="data-store-dbms.html">The Usergrid Data Store</a></li> +<li class="toctree-l1"><a class="reference internal" href="optimizing-access.html">Data Store Best Practices</a></li> +<li class="toctree-l1 current"><a class="current reference internal" href="">Collections</a><ul> +<li class="toctree-l2"><a class="reference internal" href="#creating-collections">Creating Collections</a><ul> +<li class="toctree-l3"><a class="reference internal" href="#creating-a-collection">Creating a collection</a></li> +<li class="toctree-l3"><a class="reference internal" href="#request-syntax">Request Syntax</a></li> +<li class="toctree-l3"><a class="reference internal" href="#example-request-response">Example Request/Response</a></li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="#retrieving-collections">Retrieving Collections</a><ul> +<li class="toctree-l3"><a class="reference internal" href="#retrieving-sets-of-entities-from-a-collection">Retrieving sets of entities from a collection</a></li> +<li class="toctree-l3"><a class="reference internal" href="#id1">Request Syntax</a></li> +<li class="toctree-l3"><a class="reference internal" href="#id2">Example Request/Response</a></li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="#updating-collections">Updating Collections</a><ul> +<li class="toctree-l3"><a class="reference internal" href="#batch-updating-entities-in-a-collection">Batch updating entities in a collection</a></li> +<li class="toctree-l3"><a class="reference internal" href="#id3">Request Syntax</a></li> +<li class="toctree-l3"><a class="reference internal" href="#id4">Example Request/Response</a></li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="#deleting-collections">Deleting Collections</a><ul> +<li class="toctree-l3"><a class="reference internal" href="#batch-deleting-entities-in-a-collection">Batch deleting entities in a collection</a></li> +<li class="toctree-l3"><a class="reference internal" href="#id5">Request Syntax</a></li> +<li class="toctree-l3"><a class="reference internal" href="#id6">Example Request/Response</a></li> +</ul> +</li> +</ul> +</li> +<li class="toctree-l1"><a class="reference internal" href="entities.html">Entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Data Queries</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../data-queries/querying-your-data.html">Querying your data</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-queries/query-parameters.html">Query parameters & clauses</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-queries/operators-and-types.html">Query operators & data types</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-queries/advanced-query-usage.html">Advanced query usage</a></li> +</ul> +<p class="caption"><span class="caption-text">Entity Connections</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/connecting-entities.html">Connecting entities</a></li> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/retrieving-entities.html">Retrieving connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/disconnecting-entities.html">Disconnecting entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Security & Authentication</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/app-security.html">Security & token authentication</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/using-permissions.html">Using permissions</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/authenticating-users-and-application-clients.html">Authenticating users & app clients</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/user-authentication-types.html">Authentication levels</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/changing-token-time-live-ttl.html">Changing token expiration (time-to-live)</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/authenticating-api-requests.html">Authenticating API requests</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/revoking-tokens-logout.html">Revoking tokens (logout)</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/facebook-sign.html">Facebook sign in</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/securing-your-app.html">Security best practices</a></li> +</ul> +<p class="caption"><span class="caption-text">User Management & Social Graph</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-management.html">User management & social graph</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/working-user-data.html">Working with User Data</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/group.html">Working with group data</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/activity.html">Activity</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-connections.html">Social Graph Connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-connections.html#creating-other-connections">Creating other connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/messagee-example.html">App Example - Messagee</a></li> +</ul> +<p class="caption"><span class="caption-text">Geo-location</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../geolocation/geolocation.html">Geolocating your Entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Assets & Files</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/uploading-assets.html">Uploading assets</a></li> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/retrieving-assets.html">Retrieving assets</a></li> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/folders.html">Folders</a></li> +</ul> +<p class="caption"><span class="caption-text">Counters & Events</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/events-and-counters.html">Counters & events</a></li> +<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html">Creating & incrementing counters</a></li> +<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html#decrementing-resetting-counters">Decrementing/resetting counters</a></li> +<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html#using-counters-hierarchically">Using counters hierarchically</a></li> +<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/retrieving-counters.html">Retrieving counters</a></li> +</ul> +<p class="caption"><span class="caption-text">Organizations & Applications</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/managing.html">Organization & application management</a></li> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/organization.html">Organization</a></li> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/application.html">Application</a></li> +</ul> +<p class="caption"><span class="caption-text">API Reference</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html">Methods</a></li> +<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html#models">Models</a></li> +</ul> +<p class="caption"><span class="caption-text">Client SDKs</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../sdks/tbd.html">COMING SOON...</a></li> +</ul> +<p class="caption"><span class="caption-text">Installing the Stack</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug1-deploy-to-tomcat.html">Usegrid 1: Deploying to Tomcat</a></li> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug1-launcher-quick-start.html">Usegrid 1: Launcher Quick-start</a></li> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug2-deploy-to-tomcat.html">Usergrid 2: Deploy to Tomcat</a></li> +</ul> +<p class="caption"><span class="caption-text">More about Usergrid</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../reference/presos-and-videos.html">Presentations & Videos</a></li> +<li class="toctree-l1"><a class="reference internal" href="../reference/contribute-code.html">How to Contribute Code & Docs</a></li> +</ul> + + + + </div> + + </nav> + + <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> + + + <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> + <i data-toggle="wy-nav-top" class="fa fa-bars"></i> + <a href="../index.html">Apache Usergrid</a> + </nav> + + + + <div class="wy-nav-content"> + <div class="rst-content"> + <div role="navigation" aria-label="breadcrumbs navigation"> + <ul class="wy-breadcrumbs"> + <li><a href="../index.html">Docs</a> »</li> + + <li>Collections</li> + <li class="wy-breadcrumbs-aside"> + + + <a href="../_sources/data-storage/collections.txt" rel="nofollow"> View page source</a> + + + </li> + </ul> + <hr/> +</div> + <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> + <div itemprop="articleBody"> + + <div class="section" id="collections"> +<h1>Collections<a class="headerlink" href="#collections" title="Permalink to this headline">¶</a></h1> +<div class="section" id="creating-collections"> +<h2>Creating Collections<a class="headerlink" href="#creating-collections" title="Permalink to this headline">¶</a></h2> +<p>This article describes how to create collections in Advanced Usergrid. +All entities are automatically associated with a corresponding +collection based on the type property of the entity. You may create +empty collections if you wish, but creating an entity of a new type will +automatically create a corresponding collection for you. For example, +creating a new custom “item” entity, creates an “items” collection.</p> +<p><strong>Note</strong>: Although not shown in the API examples below, you need to +provide a valid access token with each API call. See Authenticating +users and application clients for details.</p> +<div class="section" id="creating-a-collection"> +<h3>Creating a collection<a class="headerlink" href="#creating-a-collection" title="Permalink to this headline">¶</a></h3> +<p>The following example shows how to create an empty collection. +Alternatively, you can create a collection simply by creating a new +entity with a ‘type’ property that corresponds to the collection you +wish to create. For more on creating entities, see Creating Custom Data +Entities</p> +</div> +<div class="section" id="request-syntax"> +<h3>Request Syntax<a class="headerlink" href="#request-syntax" title="Permalink to this headline">¶</a></h3> +<div class="highlight-python"><div class="highlight"><pre>curl -X POST https://api.usergrid.com/<org>/<app>/<collection_name> +</pre></div> +</div> +<p>Parameters</p> +<table border="1" class="docutils"> +<colgroup> +<col width="31%" /> +<col width="69%" /> +</colgroup> +<thead valign="bottom"> +<tr class="row-odd"><th class="head">Parameter</th> +<th class="head">Description</th> +</tr> +</thead> +<tbody valign="top"> +<tr class="row-even"><td>org</td> +<td>Organization UUID or organization name</td> +</tr> +<tr class="row-odd"><td>app</td> +<td>Application UUID or application name</td> +</tr> +<tr class="row-even"><td>collection name</td> +<td>Name of the collection to create.</td> +</tr> +</tbody> +</table> +<p>If the provided value is not a plural word, Usergrid will pluralize it. +For example, providing ‘item’ will create a collection named ‘items’ but +providing ‘items’ will not create ‘itemses’.</p> +</div> +<div class="section" id="example-request-response"> +<h3>Example Request/Response<a class="headerlink" href="#example-request-response" title="Permalink to this headline">¶</a></h3> +<p>Request:</p> +<div class="highlight-python"><div class="highlight"><pre>curl -X POST "https://api.usergrid.com/your-org/your-app/item" +</pre></div> +</div> +<p>Response:</p> +<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span> + <span class="s">"action"</span> <span class="p">:</span> <span class="s">"post"</span><span class="p">,</span> + <span class="s">"application"</span> <span class="p">:</span> <span class="s">"f34f4222-a166-11e2-a7f7-02e81adcf3d0"</span><span class="p">,</span> + <span class="s">"params"</span> <span class="p">:</span> <span class="p">{</span> <span class="p">},</span> + <span class="s">"path"</span> <span class="p">:</span> <span class="s">"/items"</span><span class="p">,</span> + <span class="s">"uri"</span> <span class="p">:</span> <span class="s">"http://api.usergrid.com/your-org/your-app/items"</span><span class="p">,</span> + <span class="s">"entities"</span> <span class="p">:</span> <span class="p">[</span> <span class="p">],</span> + <span class="s">"timestamp"</span> <span class="p">:</span> <span class="mi">1378857079220</span><span class="p">,</span> + <span class="s">"duration"</span> <span class="p">:</span> <span class="mi">31</span><span class="p">,</span> + <span class="s">"organization"</span> <span class="p">:</span> <span class="s">"your-org"</span><span class="p">,</span> + <span class="s">"applicationName"</span> <span class="p">:</span> <span class="s">"your-app"</span> +<span class="p">}</span> +</pre></div> +</div> +</div> +</div> +<div class="section" id="retrieving-collections"> +<h2>Retrieving Collections<a class="headerlink" href="#retrieving-collections" title="Permalink to this headline">¶</a></h2> +<p>This article describes how to retrieve all of the entities in a +collection.</p> +<div class="admonition note"> <p class="first admonition-title"><p>Note</p> +</p> <p class="last"><p>By default, the Usergrid API returns 10 entities per request. For +collections with more than 10 entities, use the returned ‘cursor’ +property to retrieve the next 10 entities in the result set. You may +also use the LIMIT parameter in a query string to increase the number of +results returned. For more information on using cursors, see <a class="reference external" href="../data-queries/query-parameters.html">Query +Parameters</a>.</p> +</p></div><p><strong>Note</strong>: Although not shown in the API examples below, you need to +provide a valid access token with each API call. See Authenticating +users and application clients for details.</p> +<div class="section" id="retrieving-sets-of-entities-from-a-collection"> +<h3>Retrieving sets of entities from a collection<a class="headerlink" href="#retrieving-sets-of-entities-from-a-collection" title="Permalink to this headline">¶</a></h3> +</div> +<div class="section" id="id1"> +<h3>Request Syntax<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h3> +<div class="highlight-python"><div class="highlight"><pre>curl -X GET https://api.usergrid.com/<org>/<app>/<collection> +</pre></div> +</div> +<p>Parameters</p> +<table border="1" class="docutils"> +<colgroup> +<col width="25%" /> +<col width="75%" /> +</colgroup> +<thead valign="bottom"> +<tr class="row-odd"><th class="head">Parameter</th> +<th class="head">Description</th> +</tr> +</thead> +<tbody valign="top"> +<tr class="row-even"><td>org</td> +<td>Organization UUID or organization name</td> +</tr> +<tr class="row-odd"><td>app</td> +<td>Application UUID or application name</td> +</tr> +<tr class="row-even"><td>collection</td> +<td>Collection UUID or collection name</td> +</tr> +</tbody> +</table> +</div> +<div class="section" id="id2"> +<h3>Example Request/Response<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h3> +<p>Request:</p> +<div class="highlight-python"><div class="highlight"><pre>curl -X GET "https://api.usergrid.com/your-org/your-app/items" +</pre></div> +</div> +<p>Response:</p> +<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span> + <span class="s">"action"</span> <span class="p">:</span> <span class="s">"get"</span><span class="p">,</span> + <span class="s">"application"</span> <span class="p">:</span> <span class="s">"f34f4222-a166-11e2-a7f7-02e81adcf3d0"</span><span class="p">,</span> + <span class="s">"params"</span> <span class="p">:</span> <span class="p">{</span> <span class="p">},</span> + <span class="s">"path"</span> <span class="p">:</span> <span class="s">"/items"</span><span class="p">,</span> + <span class="s">"uri"</span> <span class="p">:</span> <span class="s">"http://api.usergrid.com/your-org/your-app/items"</span><span class="p">,</span> + <span class="s">"entities"</span> <span class="p">:</span> <span class="p">[</span> <span class="p">{</span> + <span class="s">"uuid"</span> <span class="p">:</span> <span class="s">"5bb76bca-1657-11e3-903f-9ff6c621a7a4"</span><span class="p">,</span> + <span class="s">"type"</span> <span class="p">:</span> <span class="s">"item"</span><span class="p">,</span> + <span class="s">"name"</span> <span class="p">:</span> <span class="s">"milk"</span><span class="p">,</span> + <span class="s">"created"</span> <span class="p">:</span> <span class="mi">1378405020796</span><span class="p">,</span> + <span class="s">"modified"</span> <span class="p">:</span> <span class="mi">1378405020796</span><span class="p">,</span> + <span class="s">"metadata"</span> <span class="p">:</span> <span class="p">{</span> + <span class="s">"path"</span> <span class="p">:</span> <span class="s">"/items/5bb76bca-1657-11e3-903f-9ff6c621a7a4"</span> + <span class="p">},</span> + <span class="s">"name"</span> <span class="p">:</span> <span class="s">"milk"</span><span class="p">,</span> + <span class="s">"price"</span> <span class="p">:</span> <span class="s">"3.25"</span> + <span class="p">},</span> <span class="p">{</span> + <span class="s">"uuid"</span> <span class="p">:</span> <span class="s">"1a9356ba-1682-11e3-a72a-81581bbaf055"</span><span class="p">,</span> + <span class="s">"type"</span> <span class="p">:</span> <span class="s">"item"</span><span class="p">,</span> + <span class="s">"name"</span> <span class="p">:</span> <span class="s">"bread"</span><span class="p">,</span> + <span class="s">"created"</span> <span class="p">:</span> <span class="mi">1378423379867</span><span class="p">,</span> + <span class="s">"modified"</span> <span class="p">:</span> <span class="mi">1378423379867</span><span class="p">,</span> + <span class="s">"metadata"</span> <span class="p">:</span> <span class="p">{</span> + <span class="s">"path"</span> <span class="p">:</span> <span class="s">"/items/1a9356ba-1682-11e3-a72a-81581bbaf055"</span> + <span class="p">},</span> + <span class="s">"name"</span> <span class="p">:</span> <span class="s">"bread"</span><span class="p">,</span> + <span class="s">"price"</span> <span class="p">:</span> <span class="s">"2.50"</span> + <span class="p">}</span> <span class="p">],</span> + <span class="s">"timestamp"</span> <span class="p">:</span> <span class="mi">1378426821261</span><span class="p">,</span> + <span class="s">"duration"</span> <span class="p">:</span> <span class="mi">35</span><span class="p">,</span> + <span class="s">"organization"</span> <span class="p">:</span> <span class="s">"your-org"</span><span class="p">,</span> + <span class="s">"applicationName"</span> <span class="p">:</span> <span class="s">"your-app"</span><span class="p">,</span> + <span class="s">"count"</span> <span class="p">:</span> <span class="mi">2</span> +<span class="p">}</span> +</pre></div> +</div> +</div> +</div> +<div class="section" id="updating-collections"> +<h2>Updating Collections<a class="headerlink" href="#updating-collections" title="Permalink to this headline">¶</a></h2> +<p>This article describes how to perform batch updates on all entities in a +collection. Batch updates require the use of a query string in the +request, which can either specify all entities in the collection or a +subset of entities for the update to be performed on. For more +information on queries, see Querying your data.</p> +<p><strong>Note</strong>: Although not shown in the API examples below, you need to +provide a valid access token with each API call. See Authenticating +users and application clients for details.</p> +<div class="section" id="batch-updating-entities-in-a-collection"> +<h3>Batch updating entities in a collection<a class="headerlink" href="#batch-updating-entities-in-a-collection" title="Permalink to this headline">¶</a></h3> +</div> +<div class="section" id="id3"> +<h3>Request Syntax<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h3> +<div class="highlight-python"><div class="highlight"><pre>curl -X PUT https://api.usergrid.com/<org>/<app>/<collection>/?ql= -d {<property>} +</pre></div> +</div> +<p>Note the empty query string (ql=) appended to the URL.</p> +<p>Parameters</p> +<table border="1" class="docutils"> +<colgroup> +<col width="23%" /> +<col width="77%" /> +</colgroup> +<thead valign="bottom"> +<tr class="row-odd"><th class="head">Parameter</th> +<th class="head">Description</th> +</tr> +</thead> +<tbody valign="top"> +<tr class="row-even"><td>org</td> +<td>Organization UUID or organization name</td> +</tr> +<tr class="row-odd"><td>app</td> +<td>Application UUID or application name</td> +</tr> +<tr class="row-even"><td>collection</td> +<td>Collection UUID or collection name property</td> +</tr> +</tbody> +</table> +<p>An entity property to be updated, formatted as a key-value pair. For +example:</p> +<div class="highlight-python"><div class="highlight"><pre>{"property_1":"value_1", "property_2":"value_2",...} +</pre></div> +</div> +</div> +<div class="section" id="id4"> +<h3>Example Request/Response<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h3> +<p>Request:</p> +<div class="highlight-python"><div class="highlight"><pre>curl -X PUT https://api.usergrid.com/your-org/your-app/items/?ql= -d '{"availability":"in-stock"}' +</pre></div> +</div> +<p>Note the empty ?ql= query string.</p> +<p>Response:</p> +<div class="highlight-python"><div class="highlight"><pre>{ + "action" : "put", + "application" : "f34f4222-a166-11e2-a7f7-02e81adcf3d0", + "params" : { + "ql" : [ "" ] + }, + "path" : "/items", + "uri" : "http://api.usergrid.com/your-org/your-app/items", + "entities" : [ { + "uuid" : "31847b9a-1a62-11e3-be04-8d05e96f700d", + "type" : "item", + "name" : "milk", + "price" : "3.25", + "availability" : "in-stock" + "created" : 1378849479113, + "modified" : 1378849567301, + "name" : "milk", + }, { + "uuid" : "3192ac6a-1a62-11e3-a24f-496ca1d42ce7", + "type" : "item", + "name" : "bread", + "price" : "4.00", + "availability" : "in-stock" + "created" : 1378849479206, + "modified" : 1378849567351, + "name" : "bread", + } ], + "timestamp" : 1378849567280, + "duration" : 207, + "organization" : "your-org", + "applicationName" : "your-app" +} +</pre></div> +</div> +</div> +</div> +<div class="section" id="deleting-collections"> +<h2>Deleting Collections<a class="headerlink" href="#deleting-collections" title="Permalink to this headline">¶</a></h2> +<p>This article describes how to batch delete entities in a collection. +Batch deletes require the use of a query string in the request, which +specifies a subset of entities to be deleted. For more information on +queries, see Querying your data.</p> +<p>Currently, collections cannot be deleted; however, you can delete all of +the entities from a collection.</p> +<p><strong>Note</strong>: Although not shown in the API examples below, you need to +provide a valid access token with each API call. See Authenticating +users and application clients for details.</p> +<div class="section" id="batch-deleting-entities-in-a-collection"> +<h3>Batch deleting entities in a collection<a class="headerlink" href="#batch-deleting-entities-in-a-collection" title="Permalink to this headline">¶</a></h3> +</div> +<div class="section" id="id5"> +<h3>Request Syntax<a class="headerlink" href="#id5" title="Permalink to this headline">¶</a></h3> +<div class="highlight-python"><div class="highlight"><pre>curl -X DELETE https://api.usergrid.com/<org>/<app>/<collection>/?ql=<query> +</pre></div> +</div> +<p>Parameters</p> +<table border="1" class="docutils"> +<colgroup> +<col width="18%" /> +<col width="83%" /> +</colgroup> +<thead valign="bottom"> +<tr class="row-odd"><th class="head">Parameter</th> +<th class="head">Description</th> +</tr> +</thead> +<tbody valign="top"> +<tr class="row-even"><td>org</td> +<td>Organization UUID or organization name</td> +</tr> +<tr class="row-odd"><td>app</td> +<td>Application UUID or application name</td> +</tr> +<tr class="row-even"><td>collection</td> +<td>Collection UUID or collection name</td> +</tr> +<tr class="row-odd"><td>query</td> +<td>A query string that specifies the subset of entities to delete</td> +</tr> +</tbody> +</table> +<p>(for more information on queries, see Querying your data)</p> +</div> +<div class="section" id="id6"> +<h3>Example Request/Response<a class="headerlink" href="#id6" title="Permalink to this headline">¶</a></h3> +<p>The following example will delete the first 5 entities in a collection.</p> +<p>Request:</p> +<div class="highlight-python"><div class="highlight"><pre>curl -X DELETE https://api.usergrid.com/your-org/your-app/items/?ql="limit=5" +</pre></div> +</div> +<p>Response:</p> +<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span> + <span class="s">"action"</span> <span class="p">:</span> <span class="s">"delete"</span><span class="p">,</span> + <span class="s">"application"</span> <span class="p">:</span> <span class="s">"f34f4222-a166-11e2-a7f7-02e81adcf3d0"</span><span class="p">,</span> + <span class="s">"params"</span> <span class="p">:</span> <span class="p">{</span> + <span class="s">"ql"</span> <span class="p">:</span> <span class="p">[</span> <span class="s">""</span> <span class="p">]</span> + <span class="p">},</span> + <span class="s">"path"</span> <span class="p">:</span> <span class="s">"/items"</span><span class="p">,</span> + <span class="s">"uri"</span> <span class="p">:</span> <span class="s">"http://api.usergrid.com/your-org/your-app/items"</span><span class="p">,</span> + <span class="s">"entities"</span> <span class="p">:</span> <span class="p">[</span> <span class="p">{</span> + <span class="s">"uuid"</span> <span class="p">:</span> <span class="s">"53fe3700-0abe-11e3-b1f7-1bd100b8059e"</span><span class="p">,</span> + <span class="s">"type"</span> <span class="p">:</span> <span class="s">"item"</span><span class="p">,</span> + <span class="s">"name"</span> <span class="p">:</span> <span class="s">"milk"</span><span class="p">,</span> + <span class="s">"price"</span> <span class="p">:</span> <span class="s">"3.25"</span><span class="p">,</span> + <span class="s">"created"</span> <span class="p">:</span> <span class="mi">1377129832047</span><span class="p">,</span> + <span class="s">"modified"</span> <span class="p">:</span> <span class="mi">1377129832047</span><span class="p">,</span> + <span class="s">"metadata"</span> <span class="p">:</span> <span class="p">{</span> + <span class="s">"path"</span> <span class="p">:</span> <span class="s">"/items/53fe3700-0abe-11e3-b1f7-1bd100b8059e"</span> + <span class="p">},</span> + <span class="s">"name"</span> <span class="p">:</span> <span class="s">"milk"</span> + <span class="p">},</span> <span class="p">{</span> + <span class="s">"uuid"</span> <span class="p">:</span> <span class="s">"5ae1fa7a-0abe-11e3-89ab-6be0003c809b"</span><span class="p">,</span> + <span class="s">"type"</span> <span class="p">:</span> <span class="s">"item"</span><span class="p">,</span> + <span class="s">"name"</span> <span class="p">:</span> <span class="s">"bread"</span><span class="p">,</span> + <span class="s">"price"</span> <span class="p">:</span> <span class="s">"4.00"</span><span class="p">,</span> + <span class="s">"created"</span> <span class="p">:</span> <span class="mi">1377129843607</span><span class="p">,</span> + <span class="s">"modified"</span> <span class="p">:</span> <span class="mi">1377129843607</span><span class="p">,</span> + <span class="s">"metadata"</span> <span class="p">:</span> <span class="p">{</span> + <span class="s">"path"</span> <span class="p">:</span> <span class="s">"/items/5ae1fa7a-0abe-11e3-89ab-6be0003c809b"</span> + <span class="p">},</span> + <span class="s">"name"</span> <span class="p">:</span> <span class="s">"bread"</span> + <span class="p">}</span> <span class="p">],</span> + <span class="s">"timestamp"</span> <span class="p">:</span> <span class="mi">1378848117272</span><span class="p">,</span> + <span class="s">"duration"</span> <span class="p">:</span> <span class="mi">12275</span><span class="p">,</span> + <span class="s">"organization"</span> <span class="p">:</span> <span class="s">"your-org"</span><span class="p">,</span> + <span class="s">"applicationName"</span> <span class="p">:</span> <span class="s">"your-app"</span> +<span class="p">}</span> +</pre></div> +</div> +</div> +</div> +</div> + + + </div> + </div> + <footer> + + <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> + + <a href="entities.html" class="btn btn-neutral float-right" title="Entities" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a> + + + <a href="optimizing-access.html" class="btn btn-neutral" title="Data Store Best Practices" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a> + + </div> + + + <hr/> + + <div role="contentinfo"> + <p> + © Copyright 2013-2015, Apache Usergrid. + + </p> + </div> + Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. + +</footer> + + </div> + </div> + + </section> + + </div> + + + + + + <script type="text/javascript"> + var DOCUMENTATION_OPTIONS = { + URL_ROOT:'../', + VERSION:'1.0', + COLLAPSE_INDEX:false, + FILE_SUFFIX:'.html', + HAS_SOURCE: true + }; + </script> + <script type="text/javascript" src="../_static/jquery.js"></script> + <script type="text/javascript" src="../_static/underscore.js"></script> + <script type="text/javascript" src="../_static/doctools.js"></script> + + + + + + <script type="text/javascript" src="../_static/js/theme.js"></script> + + + + + <script type="text/javascript"> + jQuery(function () { + SphinxRtdTheme.StickyNav.enable(); + }); + </script> + + +</body> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4a92ab09/content/docs/data-storage/data-store-dbms.html ---------------------------------------------------------------------- diff --git a/content/docs/data-storage/data-store-dbms.html b/content/docs/data-storage/data-store-dbms.html new file mode 100644 index 0000000..f30c742 --- /dev/null +++ b/content/docs/data-storage/data-store-dbms.html @@ -0,0 +1,423 @@ + + +<!DOCTYPE html> +<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> +<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> +<head> + <meta charset="utf-8"> + + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + + <title>The Usergrid Data Store — Apache Usergrid 1.0 documentation</title> + + + + + + + + + + + + + + + + <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> + + + + + + <link rel="top" title="Apache Usergrid 1.0 documentation" href="../index.html"/> + <link rel="next" title="Data Store Best Practices" href="optimizing-access.html"/> + <link rel="prev" title="Using the API" href="../getting-started/using-the-api.html"/> + + + <script src="../_static/js/modernizr.min.js"></script> + +</head> + +<body class="wy-body-for-nav" role="document"> + + <div class="wy-grid-for-nav"> + + + <nav data-toggle="wy-nav-shift" class="wy-nav-side"> + <div class="wy-side-nav-search"> + + + + <a href="../index.html" class="icon icon-home"> Apache Usergrid + + + + </a> + + + + + <div class="version"> + 1.0 + </div> + + + + +<div role="search"> + <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> + <input type="text" name="q" placeholder="Search docs" /> + <input type="hidden" name="check_keywords" value="yes" /> + <input type="hidden" name="area" value="default" /> + </form> +</div> + + + </div> + + <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> + + + + <p class="caption"><span class="caption-text">Introduction</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../introduction/usergrid-features.html">Usergrid Features</a></li> +<li class="toctree-l1"><a class="reference internal" href="../introduction/data-model.html">Usergrid Data model</a></li> +<li class="toctree-l1"><a class="reference internal" href="../introduction/async-vs-sync.html">Async vs. sync calls</a></li> +</ul> +<p class="caption"><span class="caption-text">Getting Started</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/creating-a-new-application.html">Creating a new application</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/creating-account.html">Creating an Usergrid Account</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/using-a-sandbox-app.html">Using a Sandbox Application</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/using-the-api.html">Using the API</a></li> +</ul> +<p class="caption"><span class="caption-text">Data Storage</span></p> +<ul class="current"> +<li class="toctree-l1 current"><a class="current reference internal" href="">The Usergrid Data Store</a></li> +<li class="toctree-l1"><a class="reference internal" href="optimizing-access.html">Data Store Best Practices</a></li> +<li class="toctree-l1"><a class="reference internal" href="collections.html">Collections</a></li> +<li class="toctree-l1"><a class="reference internal" href="entities.html">Entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Data Queries</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../data-queries/querying-your-data.html">Querying your data</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-queries/query-parameters.html">Query parameters & clauses</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-queries/operators-and-types.html">Query operators & data types</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-queries/advanced-query-usage.html">Advanced query usage</a></li> +</ul> +<p class="caption"><span class="caption-text">Entity Connections</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/connecting-entities.html">Connecting entities</a></li> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/retrieving-entities.html">Retrieving connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/disconnecting-entities.html">Disconnecting entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Security & Authentication</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/app-security.html">Security & token authentication</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/using-permissions.html">Using permissions</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/authenticating-users-and-application-clients.html">Authenticating users & app clients</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/user-authentication-types.html">Authentication levels</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/changing-token-time-live-ttl.html">Changing token expiration (time-to-live)</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/authenticating-api-requests.html">Authenticating API requests</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/revoking-tokens-logout.html">Revoking tokens (logout)</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/facebook-sign.html">Facebook sign in</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/securing-your-app.html">Security best practices</a></li> +</ul> +<p class="caption"><span class="caption-text">User Management & Social Graph</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-management.html">User management & social graph</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/working-user-data.html">Working with User Data</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/group.html">Working with group data</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/activity.html">Activity</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-connections.html">Social Graph Connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-connections.html#creating-other-connections">Creating other connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/messagee-example.html">App Example - Messagee</a></li> +</ul> +<p class="caption"><span class="caption-text">Geo-location</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../geolocation/geolocation.html">Geolocating your Entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Assets & Files</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/uploading-assets.html">Uploading assets</a></li> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/retrieving-assets.html">Retrieving assets</a></li> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/folders.html">Folders</a></li> +</ul> +<p class="caption"><span class="caption-text">Counters & Events</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/events-and-counters.html">Counters & events</a></li> +<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html">Creating & incrementing counters</a></li> +<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html#decrementing-resetting-counters">Decrementing/resetting counters</a></li> +<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html#using-counters-hierarchically">Using counters hierarchically</a></li> +<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/retrieving-counters.html">Retrieving counters</a></li> +</ul> +<p class="caption"><span class="caption-text">Organizations & Applications</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/managing.html">Organization & application management</a></li> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/organization.html">Organization</a></li> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/application.html">Application</a></li> +</ul> +<p class="caption"><span class="caption-text">API Reference</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html">Methods</a></li> +<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html#models">Models</a></li> +</ul> +<p class="caption"><span class="caption-text">Client SDKs</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../sdks/tbd.html">COMING SOON...</a></li> +</ul> +<p class="caption"><span class="caption-text">Installing the Stack</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug1-deploy-to-tomcat.html">Usegrid 1: Deploying to Tomcat</a></li> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug1-launcher-quick-start.html">Usegrid 1: Launcher Quick-start</a></li> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug2-deploy-to-tomcat.html">Usergrid 2: Deploy to Tomcat</a></li> +</ul> +<p class="caption"><span class="caption-text">More about Usergrid</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../reference/presos-and-videos.html">Presentations & Videos</a></li> +<li class="toctree-l1"><a class="reference internal" href="../reference/contribute-code.html">How to Contribute Code & Docs</a></li> +</ul> + + + + </div> + + </nav> + + <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> + + + <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> + <i data-toggle="wy-nav-top" class="fa fa-bars"></i> + <a href="../index.html">Apache Usergrid</a> + </nav> + + + + <div class="wy-nav-content"> + <div class="rst-content"> + <div role="navigation" aria-label="breadcrumbs navigation"> + <ul class="wy-breadcrumbs"> + <li><a href="../index.html">Docs</a> »</li> + + <li>The Usergrid Data Store</li> + <li class="wy-breadcrumbs-aside"> + + + <a href="../_sources/data-storage/data-store-dbms.txt" rel="nofollow"> View page source</a> + + + </li> + </ul> + <hr/> +</div> + <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> + <div itemprop="articleBody"> + + <div class="section" id="the-usergrid-data-store"> +<h1>The Usergrid Data Store<a class="headerlink" href="#the-usergrid-data-store" title="Permalink to this headline">¶</a></h1> +<p>The Usergrid data store is backed by Cassandra, an open source +distributed DBMS. Cassandra isnât a relational database system (RDBMS), +and is sometimes placed in the category of âNoSQLâ or âschema-lessâ +databases.</p> +<!-- workaround a Sphinx bug --> +<div class="admonition note"> <p class="first admonition-title"><p>Note</p> +</p> <p class="last"><p>Usergrid is not a relational database. Optimizing for performance on a +non-relational database like Cassandra differs a bit from relational +databases. For more information, see Optimizing access to your Usergrid +data store.</p> +</p> </div><p>Cassandra is specifically designed to support applications that need +flexibility and high scalability, particularly web and mobile +applications. Usergrid client applications write and read data formatted +as JavaScript Object Notation (JSON). (Usergrid provides SDKs through +which client apps can do much of this work in their native language. For +more information, see Usergrid SDKs.)</p> +<p>With Cassandra as the underlying DBMS, apps benefit from:</p> +<p>Fast writes to the data store. * A distributed architecture that means +no single point of failure. * Flexibility in data model design. You +aren’t constrained by a schema. * Linear scalability.</p> +<p>If you have experience with relational databases and are unfamiliar with +“NoSQL” databases, the following table might be a helpful start. It maps +the high-level concepts of an RDBMSâs data model both to Cassandraâs and +to the Usergrid, which is backed by Cassandra.</p> +<table class="usergrid-table"> +<tr> + <td></td> + <td><p>RDBMS</p> +</td> + <td><p>Cassandra</p> +</td> + <td><p>Usergrid</p> +</td> +</tr> +<tr> + <td><p>Each tuple is modeled as</p> +</td> + <td><p>A row.</p> +</td> + <td><p>A row.</p> +</td> + <td><p>An entity. Written and retrieved as JSON, an entity contains values for +all of its properties in the way a row has values for columns.</p> +</td> +</tr> +<tr> + <td><p>Each data attribute is modeled as</p> +</td> + <td><p>A column.</p> +</td> + <td><p>A column. Many thousands of columns are supported.</p> +</td> + <td><p>A entity property. An entity has a default set of properties, including +the entityâs UUID. You can add many more to support your application.</p> +</td> +</tr> +<tr> + <td><p>Each group of attributes is modeled as</p> +</td> + <td><p>A table.</p> +</td> + <td><p>A column family. Unlike rows in tables, rows in a column family can have +differing numbers of columns. Because youâre not using a schema to +define the model, you can update the column list for a row at any time.</p> +</td> + <td><p>An entity collection. As with its underlying Cassandra column family, a +collection can have entities with differing numbers of properties. In +other words, just because one entity has an authorId property doesnât +mean that other entities in its collection need to.</p> +</td> +</tr> +</table><p>The following examples from a product database provide simple +illustrations of these differences.</p> +<p>An RDBMS table has a schema-defined set of columns per row.</p> +<img alt="../_images/rdbms.png" src="../_images/rdbms.png" /> +<p>A Cassandra column family includes rows that can have differing column +sets.</p> +<img alt="../_images/cassandra.png" src="../_images/cassandra.png" /> +<p>In the JSON from the Usergrid application, the products are represented +as entities. Note that each entity in the entities array below has a +slightly different set of properties, like the columns in a Cassandra +column family.</p> +<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span> + <span class="s">"action"</span> <span class="p">:</span> <span class="s">"get"</span><span class="p">,</span> + <span class="s">"application"</span> <span class="p">:</span> <span class="s">"<app_uuid>"</span><span class="p">,</span> + <span class="s">"params"</span> <span class="p">:</span> <span class="p">{},</span> + <span class="s">"path"</span> <span class="p">:</span> <span class="s">"/products"</span><span class="p">,</span> + <span class="s">"uri"</span> <span class="p">:</span> <span class="s">"https://api.usergrid.com/my_org/my_app/products"</span><span class="p">,</span> + <span class="s">"entities"</span> <span class="p">:</span> <span class="p">[</span> <span class="p">{</span> + <span class="s">"uuid"</span> <span class="p">:</span> <span class="s">"<product_uuid>"</span><span class="p">,</span> + <span class="s">"type"</span> <span class="p">:</span> <span class="s">"product"</span><span class="p">,</span> + <span class="s">"created"</span> <span class="p">:</span> <span class="mi">1395410098517</span><span class="p">,</span> + <span class="s">"modified"</span> <span class="p">:</span> <span class="mi">1395410098517</span><span class="p">,</span> + <span class="s">"image"</span> <span class="p">:</span> <span class="s">"http://path.jpg"</span><span class="p">,</span> + <span class="s">"metadata"</span> <span class="p">:</span> <span class="p">{</span> + <span class="s">"path"</span> <span class="p">:</span> <span class="s">"/products/<product_uuid>"</span> + <span class="p">},</span> + <span class="s">"name"</span> <span class="p">:</span> <span class="s">"Bouncy Castle"</span><span class="p">,</span> + <span class="s">"sku"</span> <span class="p">:</span> <span class="s">"35450349822"</span> + <span class="p">},</span> + <span class="p">{</span> + <span class="s">"uuid"</span> <span class="p">:</span> <span class="s">"<product_uuid>"</span><span class="p">,</span> + <span class="s">"type"</span> <span class="p">:</span> <span class="s">"product"</span><span class="p">,</span> + <span class="s">"created"</span> <span class="p">:</span> <span class="mi">1395409669686</span><span class="p">,</span> + <span class="s">"modified"</span> <span class="p">:</span> <span class="mi">1395409669686</span><span class="p">,</span> + <span class="s">"image"</span> <span class="p">:</span> <span class="s">"http://path.jpg"</span><span class="p">,</span> + <span class="s">"metadata"</span> <span class="p">:</span> <span class="p">{</span> + <span class="s">"path"</span> <span class="p">:</span> <span class="s">"/products/<product_uuid>"</span> + <span class="p">},</span> + <span class="s">"description"</span> <span class="p">:</span> <span class="s">"It makes coffee."</span><span class="p">,</span> + <span class="s">"name"</span> <span class="p">:</span> <span class="s">"Coffee Maker"</span><span class="p">,</span> + <span class="s">"sku"</span> <span class="p">:</span> <span class="s">"60723023589"</span> + <span class="p">},</span> + <span class="p">{</span> + <span class="s">"uuid"</span> <span class="p">:</span> <span class="s">"<product_uuid>"</span><span class="p">,</span> + <span class="s">"type"</span> <span class="p">:</span> <span class="s">"product"</span><span class="p">,</span> + <span class="s">"created"</span> <span class="p">:</span> <span class="mi">1395407700578</span><span class="p">,</span> + <span class="s">"modified"</span> <span class="p">:</span> <span class="mi">1395407700578</span><span class="p">,</span> + <span class="s">"metadata"</span> <span class="p">:</span> <span class="p">{</span> + <span class="s">"path"</span> <span class="p">:</span> <span class="s">"/products/<product_uuid>"</span> + <span class="p">},</span> + <span class="s">"name"</span> <span class="p">:</span> <span class="s">"Air Mattress"</span><span class="p">,</span> + <span class="s">"sku"</span> <span class="p">:</span> <span class="s">"53045985365"</span> + <span class="p">}],</span> + <span class="s">"timestamp"</span> <span class="p">:</span> <span class="mi">1396290037640</span><span class="p">,</span> + <span class="s">"duration"</span> <span class="p">:</span> <span class="mi">91</span><span class="p">,</span> + <span class="s">"organization"</span> <span class="p">:</span> <span class="s">"my_org"</span><span class="p">,</span> + <span class="s">"applicationName"</span> <span class="p">:</span> <span class="s">"my_app"</span><span class="p">,</span> + <span class="s">"count"</span> <span class="p">:</span> <span class="mi">3</span> +<span class="p">}</span> +</pre></div> +</div> +</div> + + + </div> + </div> + <footer> + + <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> + + <a href="optimizing-access.html" class="btn btn-neutral float-right" title="Data Store Best Practices" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a> + + + <a href="../getting-started/using-the-api.html" class="btn btn-neutral" title="Using the API" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a> + + </div> + + + <hr/> + + <div role="contentinfo"> + <p> + © Copyright 2013-2015, Apache Usergrid. + + </p> + </div> + Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. + +</footer> + + </div> + </div> + + </section> + + </div> + + + + + + <script type="text/javascript"> + var DOCUMENTATION_OPTIONS = { + URL_ROOT:'../', + VERSION:'1.0', + COLLAPSE_INDEX:false, + FILE_SUFFIX:'.html', + HAS_SOURCE: true + }; + </script> + <script type="text/javascript" src="../_static/jquery.js"></script> + <script type="text/javascript" src="../_static/underscore.js"></script> + <script type="text/javascript" src="../_static/doctools.js"></script> + + + + + + <script type="text/javascript" src="../_static/js/theme.js"></script> + + + + + <script type="text/javascript"> + jQuery(function () { + SphinxRtdTheme.StickyNav.enable(); + }); + </script> + + +</body> +</html> \ No newline at end of file