.NET - Collection()
Creates a new Collection.
using Nitric.Sdk;using Nitric.Sdk.Resource;class Profile{public string Name { get; set; }public float Age { get; set; }}var profiles = Nitric.Collection<Profile>("profiles").With(CollectionPermission.Reading, CollectionPermission.Writing, CollectionPermission.Deleting);Nitric.Run();
Parameters
- Name
name
- Required
- Required
- Type
- string
- Description
The unique name of this Collection within the app. Subsequent calls to
Collection
with the same name will return the same object.
Access
All Nitric resources provide access permissions you can use to specify the level of access your code needs to the resource. See here for details about infrastructure security.
Available permissions:
CollectionPermission.Reading
This permission allows your code to read and query documents from the collection.
CollectionPermission.Writing
This permission allows your code to write documents to the collection.
CollectionPermission.Deleting
This permission allows your code to delete documents from the collection.
Examples
Create a collection
using Nitric.Sdk;using Nitric.Sdk.Resource;class Profile{public string Name { get; set; }public float Age { get; set; }}var profiles = Nitric.Collection<Profile>("profiles").With(CollectionPermission.Reading, CollectionPermission.Writing, CollectionPermission.Deleting);Nitric.Run();
Last updated on Oct 30, 2024