This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Problem: Given the following document in the database, I want to update | |
# Dave Gahan's second prescription for Dilaudid from a quantity of 45 to | |
# a quantity of 30. | |
{ "_id" : 1 | |
"name" : "Dave Gahan" | |
"medications" : [ | |
{ "id" : 23, | |
"name" : "Dilaudid", | |
"type" : "Rx", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
check process mongodb | |
with pidfile "/var/lib/mongodb/mongod.lock" | |
start program = "/sbin/start mongodb" | |
stop program = "/sbin/stop mongodb" | |
if failed port 28017 protocol http | |
and request "/" with timeout 10 seconds then restart | |
if 5 restarts within 5 cycles then timeout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mongoid.models.each do |model| | |
model.fields.each do |name, field| | |
# name is the string name of the field, field is the Field object. | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.bson; | |
import java.io.IOException; | |
import org.jruby.Ruby; | |
import org.jruby.RubyModule; | |
import org.jruby.RubyString; | |
import org.jruby.anno.JRubyMethod; | |
import org.jruby.runtime.builtin.IRubyObject; | |
import org.jruby.runtime.load.BasicLibraryService; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test: | |
sessions: | |
default: | |
database: mongoid_test | |
hosts: | |
- localhost:27017 | |
options: | |
consistency: :strong | |
max_retries: 30 | |
retry_interval: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
development: | |
adapter: master_slave | |
connection_adapter: mysql2 | |
database: myapp_procuction | |
username: myappuser | |
password: myapppass | |
master: | |
host: masterhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
module Rack | |
module Mongoid | |
module Middleware | |
class Sessions | |
def initialize(app) | |
@app = app | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cte_attr(*attrs) | |
attrs.each do |name| | |
class_eval <<-ATTR | |
def #{name}=(value) | |
@#{name} = value | |
super | |
end | |
ATTR | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tcp4 0 0 localhost.27017 localhost.50942 ESTABLISHED | |
tcp4 0 0 localhost.50942 localhost.27017 ESTABLISHED | |
tcp4 0 0 localhost.27017 localhost.50941 ESTABLISHED | |
tcp4 0 0 localhost.50941 localhost.27017 ESTABLISHED | |
tcp4 0 0 localhost.27017 localhost.50940 ESTABLISHED | |
tcp4 0 0 localhost.50940 localhost.27017 ESTABLISHED | |
tcp4 0 0 localhost.27017 localhost.50939 ESTABLISHED | |
tcp4 0 0 localhost.50939 localhost.27017 ESTABLISHED | |
tcp4 0 0 localhost.27017 localhost.50938 ESTABLISHED | |
tcp4 0 0 localhost.27017 localhost.50937 ESTABLISHED |
NewerOlder