website logo
⌘K
🖐️Introduction to hyper cloud
🍎Getting Started
😍What's New
Legacy Get Migration Guide
Blueberry Migration Guide
💪Workshops
Deno Workshops
NodeJS Workshops
⚡Quickstarts
NodeJS Quickstarts
🔌API Reference (hyper cloud)
🍎Basics
⚡hyper connect
🔑JWT Auth
💾Data API
🏎️Cache API
🔎Search API
🗄️Storage API
🤓Queue API
🔓Sign In
⚡Applications
⚙️Settings
🔑App Keys
👥Teams
Switching Between Accounts
Application Services
Application Service Instances
Adding a Queue Service
Adding a Search Service
Subscriptions
🤑Upgrade
📕Terminology
Parameters
💳Billing
Payment and Pricing Terms
💼Legal
Terms of Service
Acceptable Use Policy
Privacy Policy
🕶️Hyper Vision
Docs powered by
Archbee
What's New

Blueberry Migration Guide

24min

The future Blueberry release is scheduled for 1/17/2022. It will include a swap of the id field to the _id field for the primary key on data documents.

This migration guide is to prepare customers for the upcoming Blueberry release on 1/17/2022. After the Blueberry release, the id field will no longer be generated on your documents by the data service. Instead, the _id field will be generated, if your document does not already contain an _id.

Until January 17, to support the migration from id to _id, hyper will support both id and _id fields. This means the following:

  • If you are allowing the hyper data service to generate the id field on newly created documents, hyper will generate both the id and _id fields. These values are guaranteed to be the same when created by the data service.
  • When retrieving documents within your application, all documents will contain an id and _id field.

How can I prepare for Blueberry?

  • Create a Document: If you are currently providing an id to the hyper data service, you will need to provide an _id instead. If you are allowing the hyper data service to generate the id field on newly created documents, no change is required when creating new documents, hyper will instead set an _id field on your documents.
  • Query Selectors: When retrieving documents within your application or integration, any top-level id selectors will need to change to _id.
  • Additionally, any usage of id in your code will instead need to use _id.

Create a Document - POST /{appname}/data/{servicename}

Request Body

We recommend creating your own unique _id key and value in your JSON document within the request body. If the _id key is omitted in your request body, the hyper data service will create a _id key and unique value as the primary key on the document.

Text
|
curl -X POST https://cloud.hyper.io/app-moccasin-hailstorm/data/default \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ${JWT}' \
-d '{"_id": "movie-1", "title": "Ghostbusters", "type": "movie", "year": "1984"}'


Response Body

Note: A successful response will still include a document identification field named id:

JSON
|
{"ok":true,"id":"movie-1"}


Retrieve and Delete a Document By _id

  • GET /{appname}/data/{servicename}/{_id}
  • DELETE /{appname}/data/{servicename}/{_id}

Request Path Parameter

For the GETand DELETE requests, provide the _id document identifier value in the path parameter instead of an id value.

GET Response Body

If the document exists by the _id value, the return response will include the _id property/key instead of the id value:

Text
|
curl https://cloud.hyper.io/app-moccasin-hailstorm/data/default/movie-1 \
-H 'Authorization: Bearer ${JWT}'

#> {"_id":"movie-1","title":"Ghostbusters","type":"movie","year":"1984"}


DELETE Response Body

Note: A successful response will still include a document identification field named id:

JSON
|
{"ok":true,"id":"movie-1"}


Update a Document - PUT /{appname}/data/{servicename}/{_id}

This command updates an existing document in your data service, you can change/add any property on the JSON document except the _id property, it must stay the same. If you need to change the _id, simply remove the existing document and create a new document with the new _id.

Request Path Parameter

For the PUT request, provide the _id document identifier value in the path parameter instead of an id value.

Request Body

For the PUT request body, provide a JSON document with one-to-many fields. Provide _id key and value in your JSON document within the request body instead of an id value.

Text
|
curl -X PUT https://cloud.hyper.io/app-moccasin-hailstorm/data/default/movie-1 \                                               ─╯
-H 'Authorization: Bearer ${JWT}' \
-d '{"_id": "movie-1", "title": "Ghostbusters", "type": "movie", "year": "1983"}'


Response Body

Note: A successful response will still include a document identification field named id:

JSON
|
{"ok":true,"id":"movie-1"}


Bulk Documents - POST /{appname}/data/{servicename}/_bulk

Request Body

The request body takes an array of objects in JSON. You'll need to supply an _id for each document instead of an id.

JSON
|
[
  { "_id": "movie-1", "type": "movie", "title": "Ghostbusters", "_update": true },
  { "_id": "movie-2", "type": "movie", "title": "Ghostbusters 2" },
  { "_id": "movie-3", "type": "movie", "title": "Groundhog Day" }
]


Response Body

A successful bulk response body will still include a document identification key/property named id for each document affected by the bulk operation:

JSON
|
{ 
 "ok":true,
 "results": 
    [
      {"ok":true,"id":"movie-1"},
      {"ok":true,"id":"movie-2"},
      {"ok":true,"id":"movie-3"}
    ]
}


List Documents - GET /{appname}/data/{servicename}

Query String Parameters

  • the startkey key match for the document should include the value for the _id property rather than the id property.
  • the endkey key match for the document should include the value for the _id property rather than the id property.
  • the keys array should contain a collection of key _ids for returning documents rather than the id property.

Response Body

A successful list response will include a listing of documents. Each document will contain an _id property rather than an id property:

JSON
|
{
  ok: true,
  docs: [
    {
      id: 'movie-5',
      title: 'Better Off Dead',
      type: 'movie',
      year: '1985'
    }
  ]
}




Updated 20 Feb 2023
Did this page help you?
PREVIOUS
Legacy Get Migration Guide
NEXT
Workshops
Docs powered by
Archbee
TABLE OF CONTENTS
How can I prepare for Blueberry?
Create a Document - POST /{appname}/data/{servicename}
Request Body
Response Body
Retrieve and Delete a Document By _id
Request Path Parameter
GET Response Body
DELETE Response Body
Update a Document - PUT /{appname}/data/{servicename}/{_id}
Request Path Parameter
Request Body
Response Body
Bulk Documents - POST /{appname}/data/{servicename}/_bulk
Request Body
Response Body
List Documents - GET /{appname}/data/{servicename}
Query String Parameters
Response Body
Docs powered by
Archbee