Microsoft.KernelMemory.MongoDbAtlas 0.74.240919.1

Prefix Reserved
This package has a SemVer 2.0.0 package version: 0.74.240919.1+4c6c8c7.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Microsoft.KernelMemory.MongoDbAtlas --version 0.74.240919.1                
NuGet\Install-Package Microsoft.KernelMemory.MongoDbAtlas -Version 0.74.240919.1                
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="Microsoft.KernelMemory.MongoDbAtlas" Version="0.74.240919.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Microsoft.KernelMemory.MongoDbAtlas --version 0.74.240919.1                
#r "nuget: Microsoft.KernelMemory.MongoDbAtlas, 0.74.240919.1"                
#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.
// Install Microsoft.KernelMemory.MongoDbAtlas as a Cake Addin
#addin nuget:?package=Microsoft.KernelMemory.MongoDbAtlas&version=0.74.240919.1

// Install Microsoft.KernelMemory.MongoDbAtlas as a Cake Tool
#tool nuget:?package=Microsoft.KernelMemory.MongoDbAtlas&version=0.74.240919.1                

Developing with MongoDB Atlas

While MongoDB Atlas is a cloud only deployment, recently MongoDb added the ability to create local installation of Atlas thanks to Atlas Command line.

You can install Atlas Command Line Directly from MongoDB Web Site. Thanks to this tool you can create a local MongoDB atlas installation with few lines of CLI.

This local cluster is managed by podman, we need to investigate if we can create one on Docker.

Local cluster offers all the Search Capabilities of MongoDB Atlas, including Atlas Search.

Docker support

You can find all detail for recent docker support here

docker run -p 27777:27017 --privileged -it mongodb/atlas sh \
  -c "atlas deployments setup --bindIpAll --username root --password root --type local --force && tail -f /dev/null"

The original 27017 port is mapped to 27777, so it does not conflict with standard MongoDb installation you can have in the local machine.

You can change the username and password if you like, then the connection string will be

mongodb://user:password@localhost:27777/?authSource=admin

Better docker support

If you start container as shown in previous chapter, the problem is that, after you stop and restart container another instance of atlas will be created. To have a better docker support you need to create a Dockerfile with the following content

FROM mongodb/atlas

COPY startatlas.sh /usr/startatlas.sh 

CMD /usr/startatlas.sh 

Then you can create a startatlas.sh file with the following content

#!/bin/bash

# The name of the deployment to search for

# Run the command and save the output
OUTPUT=$(atlas deployments list)

echo "Output: "
echo $OUTPUT

# count line of output
LINE=$(echo "$OUTPUT" | wc -l)
echo "Count line of output: $LINE "

if [ $LINE -lt 2 ]; then
    echo "No deployment found. create a new one"
    atlas deployments setup local --bindIpAll --username root --password root --type local --force
else
    echo "Deployment found. Start it"
    atlas deployments start local
fi

function pause_atlas() {
    atlas deployments pause local
}
# This will call the 'on_exit' function when the container exits
trap pause_atlas EXIT

tail -f /dev/null

This will create a base image that can support stop/start of the container.

Creating local cluster

Once you installed Atlas CLI you can create a local MongoDB Atlas cluster with this simple instruction

 atlas deployments setup --type local

You can follow instruction, you can use both 6 or 7 version of MongoDB Atlas.

You can then list all of your environment with

atlas deployments list

And you can start/stop atlas deployment with

atlas deployment start <deployment-name>
atlas deployment pause <deployment-name>

You can then connect with the standard connection string

mongodb://localhost:27017/?directConnection=true&serverSelectionTimeoutMS=2000

Some useful commands

If in local atlas installation tests fails or you have some strange error, it could happen that the search index is corrupted. To manually delete an index, first of all list all available vector and search indexes inside the collection

db.getCollection("_ix__kernel_memory_single_index").aggregate([

{"$listSearchIndexes" : {}}
])

This will return the list of all indexes that are defined in the collection, you can delete an index using the command

db.runCommand({"dropSearchIndex" : "_ix__kernel_memory_single_index", "id" : "65e4ae1623dd55119d74571e"})
Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Microsoft.KernelMemory.MongoDbAtlas:

Package Downloads
Microsoft.KernelMemory

The package contains all the core logic and extensions of Kernel Memory, to index and query any data and documents, using LLM and natural language, tracking sources and showing citations.

GitHub repositories

This package is not used by any popular GitHub repositories.