
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
= sinatra-mongo
Extends Sinatra with an extension method for dealing with monogodb using the ruby driver.
Install it with gem:
$ gem install sinatra-mongo
Now we can use it an example application.
require 'sinatra'
require 'sinatra/mongo'
# Specify the database to use. Defaults to mongo://localhost:27017/default,
# so you will almost definitely want to change this.
#
# Alternatively, you can specify the MONGO_URL as an environment variable
set :mongo, 'mongo://localhost:27017/sinatra-mongo-example'
# At this point, you can access the Mongo::Database object using the 'mongo' helper:
puts mongo["testCollection"].insert {"name" => "MongoDB", "type" => "database", "count" => 1, "info" => {"x" => 203, "y" => '102'}}
get '/' do
mongo["testCollection"].find_one
end
If you need to use authentication, you can specify this in the mongo uri:
set :mongo, 'mongo://myuser:mypass@localhost:27017/sinatra-mongo-example'
== Mongo Reference
== Note on Patches/Pull Requests
== Copyright
Copyright (c) 2009 Joshua Nichols. See LICENSE for details.
FAQs
Unknown package
We found that sinatra-mongo demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.