Get started with Documentdb on Azure (i)

Source: Internet
Author: User
Tags documentation documentdb value store

    • What is document?

      Documentdb based PAAs (Platform-as-a-service), a data service that Microsoft configures on Azure

      It works by: Database accounts, databases, datasets. You can have multiple databases under a single database account, and each database can have multiple data sets.

    • How to configure

      Consistency level in DocumentDB: This setting is in the DocumentDB configuration, so whatever it is, use the default first.

      Consistency level in DocumentDB

From

Create a good after D oucmentdb, Azure's Dashboard (Dashboard) looks like this:

Because the version of Azure is also constantly updated, especially the dashboard layout updates, perhaps the style in this note is not the same, the content is probably the same. (2017-5-14)

    • in the Control console Alinked database in PP

      How do I find the URI and PrimaryKey of Documentdb?

      Open the "key" page after a blank do not be afraid, click on the "Read and write Key" came out. The difference between read-write and read-only keys is that the keys used by the app are different, and the permissions to access the database are different.

 

Refer to MongoDB to see the link creation process for DOUCMENTDB:

mongodb

doucmentdb

datarepositoryobject is usually operated by database

datarepositoryobject usually contains the following

Create client;

Using Client.getdatabase () method to get the database object;

 

Create Client
Documentdb has 2 methods,

    • . Readdatabaseasync (Uri databaseuri)
    • . Createdatabaseasync (Database db)

Their return value types are all resourceresponse<database>> types

It also covers the Urifactory and database two classes

    • urifactory in documents. Client under
    • Database is under Documents

By calling the Getdatabaseasync () method, take a look at

   

   

Members of the resourceresponse<database> 1

Members of the Resourceresponse<database> 2

Look at Urifactory.createdatabaseuri () What's the Devil's return URI: Nothing, probably only a originalstring can use.

Once this is done, we can already see the database we just built in the dashboard:

    • Create a data set

      A dataset consists of the space used by the data itself and the index cache space required for index data. When you create a dataset, you need to configure the index policy for the data.

      How to query and manipulate data from Doucumentdb, DOCUMENTDB's indexing strategy is defined at the documentcollection level.

      In other words, in a documentdatabase, different datasets can have different index rules.

      Index policy includes: index pattern, index path limit, data type and precision used by index

      As a database of small white, I can understand the concept of the index is:

      Take the following vessel type data as an example:

Vesselobject

{

"ID":

#int

" name ":

#string

" type ":

#enum- Handy,-panama,-cape,-other

" imo ":

#int

" nationality ":

#string

#{double, Double}

"description"

#string

}

    • index rules directly affect the size of the base library (which is the basic space for the target data store on azure), because the same data (), if only the I-D index is supported, the index layer of the dataset will be much smaller, With the addition of IMO and type and nationality indexes, the index layer will be much larger.
    • Index rules directly affect CPU overhead: One query if the index is based on the VSL ID, assuming there are 100 of data, then Azure's CPU overhead is much smaller than the overhead of traversing all vslitem.description based on a string value.
    • The index rules also affect the size of the network traffic: for example now to find a VSL, Chinese, handysize, boat width 22 meters below the ship, if the index only supports ID index, then have to return all records to the client, or 1 do not return (because the data cannot be matched); If only the index of nationality and type is supported, then all handy of Chinese nationality will be returned, assuming a total of 200 articles; If all the conditional indexes are supported, then 10 ships will be returned. The resulting flow is also different.

Then the size of the disk space, the cost of computing resources, and the flow of three of resources will affect the billing of azure. Therefore, how to rationally Configure the Indexpolicy attribute of collection is very important.

DOCUMENTDB index policy and Index pattern and index precision DOCUMENTDB indexingpolicy&indexingmode&indexingprecision

Indexing mode: public enum Indexingmode:consistent,lazy,none

Database indexing mode

The DocumentDB supports three indexing modes that can be configured with an index policy for the DocumentDB collection: Consistent, deferred, and none.

consistent: If the The policy for the DocumentDB collection is specified as consistent, and queries against the specified DocumentDB collection are performed (that is, strong, limited expiration, session, or final) at the specified consistency level for point reads. The index is updated synchronously as part of a document update (that is, inserting, replacing, updating, and deleting documents in the DocumentDB collection). Consistent indexes support consistent queries, but at the cost of potentially reducing write throughput. This reduction is affected by the unique path and the "consistency level" of the required index. A consistent indexing pattern applies to the fast write, immediate query workload.

latency: To achieve maximum document ingestion throughput, you can The DocumentDB collection configures delay consistency, which means that the query is ultimately consistent. the index is updated asynchronously when the DocumentDB collection is in a quiescent state (that is, the throughput of the collection is not fully exploited when the user requests a service). For the "Introduce now, query later" workload that requires unhindered document ingestion, it may be appropriate for the deferred indexing mode.

None: The collection with the index pattern marked as "none" has no index associated with it. This pattern is typically used if DocumentDB is used as a key-value store and accesses the document only through its ID property.

From

 

Official introduction is not a man-of-the-line, look at a half-day out of a general meaning is when the data changes can be found in the index layer, the same is no matter whether the system is busy, any data changes are immediately updated to the index layer, the delay is not busy when the update, a moment can be found; None is the change to the data value does not reflect at all to the index layer, only through the data key can retrieve the data.

And more about indexing strategies see:

index path from

index data type, kind, and precision from

After you follow the methods in guidance, you can see the properties of the newly created collection, where the default indexingmode is consistent.

Then look at Azure's dashboard, and the new dataset shows up.

    • Create data
    • Deletion of additional changes

Get started with Documentdb on Azure (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.