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
var customerAggregations = provider.AggregationSet<Customer>(); | |
customerAggregations.Apply(x =>x.RecordShell.Age + 3, | |
"AgeInThreeYears"); |
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
#include <stdio.h> | |
#include "mongo.h" | |
int main() { | |
mongo conn[1]; | |
int status = mongo_connect( conn, "127.0.0.1", 27017 ); | |
if( status != MONGO_OK ) { | |
switch ( conn->err ) { | |
case MONGO_CONN_SUCCESS: printf( "connection succeeded\n" ); break; |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'bundler/setup' | |
require 'mongo' | |
@conn = Mongo::Connection.new | |
@db = @conn['supply_chain_development'] | |
puts @db['properties'].find.to_a.size |
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
/* | |
* Title: tutorial.c | |
* Author: Christopher Triolo | |
* Build & Run: | |
* $ gcc -Isrc --std=c99 tutorial.c /path/to/mongo-c-driver/src/*.c -I /path/to/mongo-c-driver/src/ -o tutorial | |
* $ ./tutorial | |
* connection succeeded | |
* ... | |
* connection closed | |
*/ |
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
{"rp": | |
{"AdSpot": [ | |
{"1": {"a": "b"}}, | |
{"2": {"a": "b"}}, | |
{"3": {"a": "b"}}] | |
} | |
} | |
db.collection.find({"rp.AdSpot": {$in: [{"1": {"a": "b"}}, {"2": {"a": "b"}]}}) |
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
## | |
# shoulda-mini | |
# based on test/spec/mini 5 | |
# http://gist.github.com/307649 | |
# chris@ozmm.org | |
# | |
def context(*args, &block) | |
return super unless (name = args.first) && block | |
require 'test/unit' | |
klass = Class.new(defined?(ActiveSupport::TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase) do |
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
# mongo_template.rb | |
# fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842) | |
# | |
# To use: | |
# rails project_name -m http://gist.github.com/gists/219223.txt | |
# remove unneeded defaults | |
run "rm public/index.html" | |
run "rm public/images/rails.png" | |
run "rm public/javascripts/controls.js" |