mongodb

Hard to think of a reason why MongoDB doesn't create /data/db for us automatically?

I installed MongoDB both on Win 7 and on Mac OS X, and both places, I got mongod (the server) and mongo (the client). But at both places, running mongod will fail if I double click on the file, and the error message was gone too quickly before I can see anything. (was better on Mac because Terminal didn't exit automatically and showe...

Can MongoDB compress or mark a word that shows up frequently (such as "shopping") as s1 to save space?

Say if the app is like Digg, where users post a web link and add tags. Then there will be many tags that says "shopping", repeatedly in the value part of the key/value pair. Will MongoDB automatically or be configured so that it will remember that word as "s1" so as to reduce the size of the database? What if it is the key part that r...

mongodb mapreduce returning inconsistent results

I have a super simple map reduce test... that isn't working consistently. In a nutshell, I'm just looking for duplicate records. I have a collection that has: GiftIdea - site_id - site_key the site_id + site_key should be unique, but currently isn't. So I have the following map reduce code: var map = function() { print(this.s...

cloud based hosted database solution for mongodb

What kind of cloud based hosted database solution(s) are available for hosting mongodb as a service. MongoHQ seems to offer this service, but are there other vendors? ...

Default risks of losing data on a single MongoDB server

My particular scenario: I want to spin up a new Linode VM solo for running MongoDB. I'll have backup services and etc. for everything related to the disk, so this question about 'risk' pertains only to the following. I've been reading the MongoDB documentation and I've gotten to the fsync portion. It mentions that data in memory is writ...

Basics of MongoDB Scripts - How to

What are the basics of MongoDB Scripts? I think the script will end with .js, and we run it using mongo try.js But if I put print(db.foo.find()) in try.js and use mongo try.js it will say MongoDB shell version: 1.6.1 connecting to: test DBQuery: test.foo -> undefined and if I use the interactive shell by typing mongo and type >...

Connecting to mongodb through the browser?

Hi, Im reading the mongodb guide, but I dont get this: mongodb://fred:foobar@localhost It says I can connect to the mongodb through web browser. I have tried this, but it doesn't work. Safari/Firefox can't recognize the mongodb protocol. And why should I do it? Isn't the mongodb server just for connecting through the command line?...

MongoDB ruby driver is on top of the javascript driver?

I wonder if the ruby driver for MongoDB is using the native javascript driver, or is it using c++ directly? ...

Does MongoDB have a Ruby Shell or Python Shell in addition to the Javascript shell?

Or, does using Ruby's irb and then require 'mongo' and adding some Connect statement essentially act like a Ruby shell... it would be great if a Ruby shell can be possible which as convenient as the Javascript Shell. ...

Why doesn't MongoDB extend object to be able to use a.tojson() but still require tojson(a)?

or have it both ways? ...

Does django with mongodb make migrations a thing of the past?

Since mongo doesn't have a schema, does that mean that we won't have to do migrations when we change the models? What does the migration process look like with a non-relational db? ...

Getting Mongoid from params array

In order to find a Root Document that contains a embedded document using MongoID/Rails 3 I need to do my query this way: QuoteRequest.where( "order_request_items._id" => BSON::ObjectID(params[:id]) ).first Is there a way to query without using the BSON::ObjectID ? Thanks! ...

MongoDB's mongosniff won't start?

mongosniff is for looking at what's sent to the MongoDB server, but on a Mac with OS X Snow Leopard, it says error finding device: no suitable device found this is when mongod is running fine. Is there something that can make it work? Update: thanks. after running it as root, for some reason it is not reporting any activities when ...

How should I architect my DB & API server for a turn based multiplayer iPhone board game? (thinking about nodejs, mongo, couch, etc)

I'm working on a turn based board game for iPhone and eventually Android. I'm using Appcelerator Titanium to develop it. My multiplayer design is similar to Words With Friends. Users take turns when ready, and then the opponent's game board is updated accordingly. One of my needs is to have a messaging API which enables the 2 players' d...

Safe write from the mongodb shell

How do I do a "safe" write that flushes to disk immediately from javascript? I'd like to be able to do this from both the shell and a stored javascript "CRUD" procedure. Is it just a matter of: db.foo.insert({stuff: "yes", meta: "physics"}); db.runCommand( "getlasterror" ) ; The wiki is unclear on this. ...

Mongoid/activesupport version problem

I'm attempting to use Mongoid from a plain Ruby script (not via Rails or any other framework) and I think I'm running into some version dependency conflicts: /opt/local/lib/ruby/site_ruby/1.8/rubygems.rb:779:in `report_activate_error': RubyGem version error: activesupport(3.0.0 not >= 2.2.2, < 3.0.pre) (Gem::LoadError) from /opt/loc...

How to get last inserted id using the JS api?

Using the javascript api for MongoDB, how do you get the ID of the last inserted object? i.e. obj = {a: 1, b: 2}; db.foo.insert(obj); How do I get the ID for obj? ...

Database to choose for game

I'm working on a game (something like chess) where every move needs to be saved into a database per move. Since it's very important that both reads and writes are fast, and I don't need complex queries, I'm probably going to go with a NoSQL solution. Which one though? I'm thinking about MongoDB but will its durability be an issue? It'...

Using Mongoid (Ruby on Rails's MongoDB mapper), do we need to set a type if Cat inherits from Animal?

that is, if app/models/animal.rb has class Animal include Mongoid::Document field :name, :type => String field :birthday, :type => Time end and then in app/models/cat.rb class Cat < Animal include Mongoid::Document field :nail_length, :type => Float end then do you need to set some kind of "type" in Animal to remember it ...

Using Mongoid (MongoDB mapper for Ruby on Rails), why s.save returns true but record not updated?

If the following code is run twice, both times s.save will return true, indicating success, but the second time, the time won't be updated? foo = Foo.new foo._id = 100 foo.time = Time.now p foo.save ...