Skip to content

Instantly share code, notes, and snippets.

@Gab-km
Created June 3, 2014 11:32
Show Gist options
  • Save Gab-km/25b00d110e4fea0306a4 to your computer and use it in GitHub Desktop.
Save Gab-km/25b00d110e4fea0306a4 to your computer and use it in GitHub Desktop.
MongDB の C# Driver を PowerShell から使ってみた
[System.Reflection.Assembly]::LoadFile('/path/to/MongoDB.Driver.dll')
[System.Reflection.Assembly]::LoadFile('/path/to/MongoDB.Bson.dll')
$client = New-Object MongoDB.Driver.MongoClient("mongodb://hostname")
$server = $client.GetServer()
$db = $server.GetDatabase("test")
$user = $db.GetCollection("User")
foreach($doc in $user.FindAll() {
[System.Console]::WriteLine($doc)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment