moped
moped copied to clipboard
Duplicated key when inserting with string and symbol.
When inserting into mongo a duplicated key with the same name but one as string and the other as a symbol, It generates a duplicated key in mongo with a wired behavior for the assignment.
The following code,
require 'moped'
require 'bson'
session = Moped::Session.new([ "localhost:27017" ])
session.use('test')
session['test'].insert({ 'a' => 1, b: 2, a: 2 })
generate this in mongo:
{ "_id" : ObjectId("54455288f1aa7bbc3271c0ab"), "a" : 1, "b" : 2, "a" : 1 }
see: https://github.com/mongoid/moped/issues/282
also see: https://jira.mongodb.org/browse/RUBY-761