mongodb

mongoid with rails - Database should be a Mongo::DB, not NilClass"

Greetings I am trying to get Mongoid to work with my Rails app and I am getting an error: "Mongoid::Errors::InvalidDatabase in 'Shipment bol should be unique' Database should be a Mongo::DB, not NilClass" I have created the mongoid.yml file in my config directory and have mongodb running as a daemon. The config file is like so: d...

Find objects between two dates MongoDB

I've been playing around storing tweets inside mongodb, each object looks like this: { "_id" : ObjectId("4c02c58de500fe1be1000005"), "contributors" : null, "text" : "Hello world", "user" : { "following" : null, "followers_count" : 5, "utc_offset" : null, "location" : "", "profile_text_color" : "000000", "friends_...

MongoDB vs CouchDB (Speed optimization)

Hi! I made some tests of speed to compare MongoDB and CouchDB. Only inserts were while testing. I got MongoDB 15x faster than CouchDB. I know that it is because of sockets vs http. But, it is very interesting for me how can I optimize inserts in CouchDB? Test platform: Windows XP SP3 32 bit. I used last versions of MongoDB, MongoDB C# ...

Mongodb: Connection reset by peer

I have a Mongo server running on an Ubuntu box, and I am trying to connect to it with pymongo using the usual syntax: from pymongo import Connection c = Connection('db.example.com', 27017) This works just fine on a recent-model Intel mac (OS 10.6). However, the same code on an older G5 tower (10.5) throws this error: pymongo.errors....

Mongodb update: how to check if an update succeeds or fails?

I think the title pretty much says it all. I'm working with Mongodb in PHP using the pecl driver. My updates are working great, but I'd like to build some error checking into my funciton(s). I've tried using lastError() in a pretty simple function: function system_db_update_object($query, $values, $database, $collection) { $conne...

Does any know if there is MongoDB-CSharp driver documentation?

I'm looking at using the MongoDB-CSharp driver for MongoDB on a small test project. The downloads have binary and source, but I can't find any documentation anywhere. Does anyone know if there's documentation for MongoDB-CSharp, or should I just be reading the source?? Thanks ...

Reducing MongoDB database file size

Hi, I've got a mongoDB database that was once large (>3Go). Since then, documents have been deleted and I was expecting the size of the db files to decrease accordingly. But since mongoDB keeps allocated space, the files are still large. I read here and there that the admin command mongod --repair is used to free the unused space, but...

Mongodb MapReduce to concatenate strings?

All of the MongoDB MapReduce examples I have seen have dealt with counting/adding numbers. I need to combine strings, and it looks like MapReduce is the best tool for the job. I have a large MongoDB collection in this format: {name: userone, type: typeone} {name: usertwo, type: typetwo} {name: userthree, type: typeone} Each name only ...

mongodb read/write performance and mongo hosting in the cloud

we are currently developing a high traffic rails application with facebooker (facebook game). since amazon simpledb (aws-sdb) is really slow, we are thinking of using a dedicated mongodb server as offered by mongoHQ for example. questions: what is the read/writes peak value for a mongodb server running on a amazon ec2 instance? what w...

Using the MongoDB Ruby driver in Rails? (without an object mapper)

I have recently been getting my feet wet in MongoDB using Mongoid w/ Rails 3, but I'm now interested in learning the low level MongoDB features using only the Ruby driver, and trying some map/reduce that would not be possible through Mongoid (afaik) I'm not entirely sure where in Rails I should be setting up the db connections etc, and ...

I wanna build a website, use mongodb, is it free? Do I need to open my source of website?

I've read the licence page of mongodb, found it under AGPL. Sorry for my poor English, I don't understand it well. I want to build a public commercial website with mongodb, I just use it as my database, storing some data, and won't modify it. Do I need to: open my source code of my website? or pay for it? ...

Finding changes in MongoDB database

I'm designing a MongoDB database that works with a script that periodically polls a resource and gets back a response which is stored in the database. Right now my database has one collection with four fields , id, name, timestamp and data. I need to be able to find out which names had changes in the data field between script runs, an...

Database over 2GB in MongoDB

We've got a file-based program we want to convert to use a document database, specifically MongoDB. Problem is, MongoDB is limited to 2GB on 32-bit machines (according to http://www.mongodb.org/display/DOCS/FAQ#FAQ-Whatarethe32bitlimitations%3F), and a lot of our users will have over 2GB of data. Is there a way to have MongoDB use more t...

Broken sorting by values from embedded documents in MongoDB?

I am trying to sort the documents which I retrieve from MongoDB by a key that is in the first of several embedded documents. I am using mongod v1.4.3 with the ruby gem mongo-1.0.2. One document looks like this: >> pp MONGODB.collection('hotel_offer_groups').find_one "offers"=> [{"price"=>520.0, "rate"=>nil, "id"=>523960640,...

MongoDB MapReduce: Global variables within map function instance?

I've written a MapReduce in MongoDB and would like to use a global variable as a cache to write to/read from. I know it is not possible to have global variables across map function instances - I just want a global variable within each function instance. This type of functionality exists in Hadoop's MapReduce so I was expecting it to be t...

Using map/reduce for mapping the properties in a collection

Update: follow-up to MongoDB Get names of all keys in collection. As pointed out by Kristina, one can use Mongodb 's map/reduce to list the keys in a collection: db.things.insert( { type : ['dog', 'cat'] } ); db.things.insert( { egg : ['cat'] } ); db.things.insert( { type : [] }); db.things.insert( { hello : [] } ); mr = db.runComm...

php/mongodb: how does references work in php?

hello, i asked this in the mongodb user-group, but was not satisfied with the answer, so -- maybe someone at stackoverflow can enlighten me: EDIT: i've re-written my question, because apparently it wasn't clear, what was happening -- please try my test-code before answering. thanks! <?php // test: a $data = array('x' => 1); functio...

Mongo Map Reduce first time

Hello guys, First time Map/Reduce user here, and using MongoDB. I have a lot of page visit data which I'd like to make some sense of by using Map/Reduce. Below is basically what I want to do, but as a total beginner a Map/Reduce, I think this is above my knowledge! Go through all the pages with visits in the last 30 days, and where ex...

Drive space hungry NoSQL's databases

I've tested NoSQL databases like CouchDB, MongoDB and Cassandra and observed tendence to absorbing very large amount of drive space relative to inserted key-value pairs. When comparing CouchDB and MySQL schemaless databases CouchDB is consuming much more drive space than MySQL. I know about that key-value DBs by default are versioning ...

MongoDB vs. Redis vs. Cassandra for a fast-write, temporary row storage solution

Hi there, I'm building a system that tracks and verifies ad impressions and clicks. This means that there are a lot of insert commands (about 90/second average, peaking at 250) and some read operations, but the focus is on performance and making it blazing-fast. The system is currently on MongoDB, but I've been introduced to Cassandra ...