InterSystems.Data.Document 1.1.0

Prefix Reserved
dotnet add package InterSystems.Data.Document --version 1.1.0
                    
NuGet\Install-Package InterSystems.Data.Document -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="InterSystems.Data.Document" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="InterSystems.Data.Document" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="InterSystems.Data.Document" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add InterSystems.Data.Document --version 1.1.0
                    
#r "nuget: InterSystems.Data.Document, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=InterSystems.Data.Document&version=1.1.0
                    
Install InterSystems.Data.Document as a Cake Addin
#tool nuget:?package=InterSystems.Data.Document&version=1.1.0
                    
Install InterSystems.Data.Document as a Cake Tool

InterSystems Document-Dotnet

Document-dotnet allows for interaction with IRIS using Documents (JSONObjects and JSONArrays).

Getting started

Install the package

Install the IRISClient library for .NET with NuGet

dotnet add package InterSystems.Data.Document

Prerequisites

You need an IRIS instance to interact with while using this package. The IRIS instance does not need to be on the same machine as the project using this package, but the project must be able to connect to the IRIS instance.

Examples

using InterSystems.Document;

// Establish IRIS connection parameters
DataSource dataSource = DataSource.CreateDataSource();
string host = "localhost";
string port = "1972";
string ns = "USER";
string user = "_system";
string pwd = "SYS";
string connectionString = $"Server={host}; Port={port}; Namespace={ns}; User ID={user}; Password={pwd}";
dataSource.SetConnectionString(connectionString);

// Create a collection object (or retrieves if it already exists)
Collection collection = Collection.GetCollection(dataSource, "MyCollection");

// Create documents from JSON data, Object or Array
string jsonString1 = "{\"firstName\":\"John\",\"lastname\":\"Smith\",\"age\":30,\"employed\":true}";
string jsonString2 = "[\"green\",\"blue\",\"pink\"]";
Document doc1 = Document.FromJSONString(jsonString1);
Document doc2 = Document.FromJSONString(jsonString2);

// Documents can also be created directly
JSONObject obj = new JSONObject();
obj["firstName"] = "Mary";
obj["age"] = 50;

JSONArray arr = new JSONArray();
arr.Add("red");
arr.Add("blue");
arr.Add("green");

// Add the Documents to the collection
List<Document> docs = new List<Document> { doc1, doc2, obj, arr };
List<string> ids = collection.Insert(docs).GetIds();

long size = collection.Size();
Console.WriteLine($"Collection size: {size}");

// Retrieve objects and arrays from the collection using bracket notation or Get methods
JSONObject objReturned = (JSONObject)collection.Get(ids[0]);
string name = (string)objReturned["firstName"];
int? age = objReturned.GetInt32("age");
Console.WriteLine($"Object {ids[0]} has name {name} and is {age} years old");

JSONArray arrReturned = (JSONArray)collection.Get(ids[3]);
int arrSize = arrReturned.Size();
for (int i = 0; i < arrSize; i++)
{
    Console.WriteLine($"{i}: {arrReturned[i]}");
}

// Delete the collection
collection.Drop();

// Close the DataSource when finished
dataSource.Close();
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 105 2/20/2025
1.0.2 203 2/4/2025