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
// npm install mongodb | |
var mongodb = require('mongodb'); | |
var url = require('url'); | |
var log = console.log; | |
var connectionUri = url.parse(process.env.MONGOHQ_URL); | |
var dbName = connectionUri.pathname.replace(/^\//, ''); | |
mongodb.Db.connect(process.env.MONGOHQ_URL, function(error, client) { | |
if (error) throw error; |
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
# npm install mongodb | |
mongodb = require 'mongodb' | |
url = require 'url' | |
log = console.log | |
connection_uri = url.parse(process.env.MONGOHQ_URL) | |
db_name = connection_uri.pathname.replace(/^\//, '') | |
mongodb.Db.connect process.env.MONGOHQ_URL, (error, client)-> | |
throw error if error |
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
# gem install mongo bson_ext json | |
require 'rubygems' # if less than Ruby 1.9 | |
require 'mongo' | |
require 'uri' | |
require 'json' | |
def get_connection | |
return @db_connection if @db_connection | |
db = URI.parse(ENV['MONGOHQ_URL']) | |
db_name = db.path.gsub(/^\//, '') |
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
<!-- PHP Mongo Docs: http://php.net/manual/en/class.mongodb.php --> | |
<html> | |
<body> | |
<h1>MongoHQ Test</h1> | |
<?php | |
try { | |
// connect to MongoHQ assuming your MONGOHQ_URL environment | |
// variable contains the connection string | |
$connection_url = getenv("MONGOHQ_URL"); |
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 | |
require 'riak' | |
require 'rsolr' | |
require 'ap' | |
client = Riak::Client.new(nodes: [{pb_port:10017}]) | |
people = client.bucket('people') | |
map = Riak::Crdt::Map.new(people, 'eric', 'maps') | |
map.registers['first'] = 'MY_NAME' |
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
## Set SC from off to on | |
find /riak/dev -name riak.conf | xargs sed -i -e "s/## strong_consistency = on/strong_consistency = on/" | |
## restart each node in order | |
for d in `ls /riak/dev`; do /riak/dev/$d/bin/riak restart; done |
NewerOlder