
Product
Introducing Rust Support in Socket
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
= Welcome to MongoRecord
== Unsupported
Note: MongoRecord is no longer supported by its authors. For a list of MongoDB object mappers, see http://is.gd/gdehy.
== What MongoRecord was
MongoRecord is an ActiveRecord-like framework for MongoDB[http://www.mongodb.org/].
This document assumes you have read the MongoDB documentation.
A quick code sample:
require 'rubygems' require 'mongo' require 'mongo_record'
class Track < MongoRecord::Base collection_name :tracks fields :artist, :album, :song, :track index :artist
def to_s
"artist: #{artist}, album: #{album}, song: #@song, track: #{@track ? @track.to_i : nil}"
end
end
MongoRecord::Base.connection = Mongo::Connection.new.db('mongorecord-test')
t = Track.new(:artist => 'Level 42', :album => 'Standing In The Light', :song => 'Micro-Kid', :track => 1) t.save puts "There are #{Track.count()} tracks." t = Track.find(:first, :conditions => {:song => 'Micro-Kid'}) Track.find(:all, :sort => 'song').each { |t| puts t.to_s }
== Installation
$ gem install mongo_record
MongoRecord depends on the Mongo Ruby Driver, version 0.20.1 or higher. Installing the MongoRecord gem will also install the Mongo Ruby Driver if you don't have it already.
The source code is available at http://github.com/mongodb/mongo-ruby-driver. You can either clone the git repository or download a tarball or zip file. Once you have the source, you can use it from wherever you downloaded it or you can install it as a gem from the source by typing
$ rake gem:install
== Getting Started
See the examples, read the MongoRecord::Base and MongoRecord::Cursor documentation, and look at tests/test_mongo.rb.
=== Persistence
You can use MongoRecord::Base or talk to the database (stored in the $db object) directly.
See MongoRecord::Base and MongoRecord::Cursor.
=== Logger
See MongoRecord::LogDevice. When running outside of the cloud (for example, during development), all log messages are echoed to $stderr which is normally the console.
== Credits Jim Mulholland, jim at squeejee dot com
Clinton R. Nixon, crnixon at gmail dot com
Nate Wiger, http://github.com/nateware
Camilo Lopez
FAQs
Unknown package
We found that mongo_record demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.