Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partition key validation on CreateContainerIfNotExistsAsync and code documentation update #572

Merged
merged 15 commits into from Jul 25, 2019

Conversation

simplynaveen20
Copy link
Member

This PR will add the code for comparing partition key definition retrieved from server on CreateContainerIfNotExistsAsync api with the one provided by user and throw exception if they are not equal.
Also updating code documentation for CreateIfNotExistsAsync both for container and database.

Closing issues

closes #549

j82w
j82w previously approved these changes Jul 24, 2019
/// <para>Check if a database exists, and if it doesn't, create it.
/// Only the database id is used to verify if there is an existing database. Other database properties such as throughput are not validated and can be different then the passed properties.</para>
///
/// Status code 201: New database is created.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    /// <returns>
    /// A <see cref="Task"/> containing a <see cref="DatabaseResponse"/> which wraps a <see cref="DatabaseProperties"/> containing the read resource record.
    /// </returns>
    /// <exception cref="CosmosException">This exception can encapsulate many different types of errors. To determine the specific error always look at the StatusCode property. Some common codes you may get when creating a Document are:
    /// <list>
    ///     <listheader>
    ///         <term>StatusCode</term><description>Reason for exception</description>
    ///     </listheader>
    ///     <item>
    ///         <term>404</term><description>NotFound - This means the resource you tried to read did not exist.</description>
    ///     </item>
    ///     <item>
    ///         <term>429</term><description>TooManyRequests - This means you have exceeded the number of request units per second.</description>
    ///     </item>
    /// </list>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StatusCode representation consistency with other places

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

404 is not applicable in case of createifnotexist

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a new iteration using the list format for the status codes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Database/Container CreateIfNotExists guarantees
3 participants