Skip to content

Instantly share code, notes, and snippets.

@jptix
Created May 9, 2010 23:10
Show Gist options
  • Save jptix/395485 to your computer and use it in GitHub Desktop.
Save jptix/395485 to your computer and use it in GitHub Desktop.
/home/jptix/.rvm/gems/ruby-1.9.1-p378/gems/bson-1.0.1/lib/bson/bson_c.rb:8:in `serialize': key must not start with '$' (BSON::InvalidKeyName)
from /home/jptix/.rvm/gems/ruby-1.9.1-p378/gems/bson-1.0.1/lib/bson/bson_c.rb:8:in `serialize'
from /home/jptix/.rvm/gems/ruby-1.9.1-p378/gems/em-mongo-0.2.6/lib/em-mongo/connection.rb:85:in `update'
from /home/jptix/.rvm/gems/ruby-1.9.1-p378/gems/em-mongo-0.2.6/lib/em-mongo/collection.rb:35:in `update'
from mongoimport.rb:13:in `block in <main>'
from /home/jptix/.rvm/gems/ruby-1.9.1-p378/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `call'
from /home/jptix/.rvm/gems/ruby-1.9.1-p378/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
from /home/jptix/.rvm/gems/ruby-1.9.1-p378/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
from mongoimport.rb:11:in `<main>'
require "rubygems"
require "em-mongo"
require "mongo"
coll = Mongo::Connection.new.db("foo").collection("bar")
coll.update({:uri => "testuri"}, {:$inc => {:count => 1}, :$addToSet => {:user => "someuser"}}, :upsert => true)
EM.run do
coll = EM::Mongo::Connection.new.db("foo").collection("bar")
coll.update({:uri => "anotheruri"}, {:$inc => {:count => 1}, :$addToSet => {:user => "someuser"}}, :upsert => true)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment