我在下面的愚蠢简单的ruby / mongo代码中遇到了一个问题:
def initMongo
@client.new(['127.0.0.1:27017'])
end
def creatDB(name)
@database = @database.new(@client, name)
end
def creatCollection(name)
@collection = @collection.new(@database, name)
@collection.insert_one({name: 'test'})
@collection.inspect
end
@collection.insert_one({name: 'test'})
我得到:
/collection.rb:129:in write_concern&#39 ;: undefined method write_concern' for Mongo :: Client:Class
Ruby v2.2.3 Mongo v2.2
答案 0 :(得分:0)
问题在于:
CURLOPT_INFILE
替换为:
def initMongo
@client.new(['127.0.0.1:27017'])
end