mongodb

how to put embedded document into an embedded document ?

hi I have a form that has a category model and and embeded docuement called "FieldModule" and this has embedded document called "SubFieldModule" For example class Category include MongoMapper::Document key :name, String many :field_modules end class FieldModule include MongoMapper::EmbeddedDocument key :name, String ...

I get this error that I don't understand why, using NoRM and Mongo in my MVC project

Cannot access a disposed object. Object name: 'System.Net.Sockets.TcpClient'. I don't understand why it happen and how to deal with it. I use Ninject, my application is based on mvcstarter.codeplex.com/ what I do is delete some user or pages from my database and it happen for no reason(that I can find). Any help would be appreciated! ...

Learning RoR and Mongo, why not count the array for votes

I'm completely new to Mongo and RoR, coming from a PHP background. I was just going through this tutorial about data modelling http://www.mongodb.org/display/DOCS/MongoDB+Data+Modeling+and+Rails and was struck with the question of why the tutorial would recommend storing the votes in a field and updating that field as db.stories.upda...

mongodb indexes with $where

If I write a query and filter results using $where on an indexed field, will it use the index or will it scan into each document? For example?: function () { return this.indexed_field > 5 } ..and yes I'm well aware I could get away with using $gt in this particular instance =) ...

MongoDB: Count of matching nested array elements.

I've got a simple parent child object stored as a document in MongoDB. Something simplistic like Order/OrderItems. (Order has an array of OrderItem) What I'd like to do is query for a count of Order Items where they meet a set of criteria. Example: In Order "999" find out how many order items had a quantity of 3. db.collection.fin...

mongodb search results

I'd like to display the total of number of records a query found and then the search results below it. Currently I do this with 2 queries like so: $total_results = $mydb->count($qry); $r = $mydb->find($qry) ->skip($pagination*$results_per_page) ->limit($results_per_page); Is it possible to somehow combine the coun...

Problem installing MongoDB using MacPorts

Im trying to install MongoDB on Snow Leopard using MacPorts, as explained on the MongoDB site (http://www.mongodb.org/display/DOCS/Quickstart+OS+X). However, it's stuck 'building boost'. Nothing's happened for 20 minutes. The progress from the terminal is attached. Any help on this would be appreciated. Im excited to check out MongoD...

MongoDB: Get count of Array

Given these documents: db.orders.insert( {OrderId:1, OrderItems: [{OrderItemId:1, Qty:1}, {OrderItemId:2, Qty:1} ]} ); db.orders.insert( {OrderId:2, OrderItems: [{OrderItemId:1, Qty:1}, {OrderItemId:2, Qty:2} ]} ); I'd like to get the count of all OrderItems where the Qty = 1 (expected result 3). This is how I think to write the quer...

MongoDB - will it fit a small hobby web application?

I'm working on a small web application using the Python Flask framework. For a few happy weeks SQLAlchemy was a perfect fit for my needs. In the meantime I found out more about MongoDB, played with it locally and started thinking of using it instead of MySql along with SQLAlchemy. Is this a good idea in terms of: Suitability. The pro...

Developing financial application

My boss wants me to develop an application very similar to an accounting system (that will be a part of another big system, written in ruby (using rails) and javascript (using extjs)) How can I start? For example, I had a plan to use mongodb for our system, but now I'm not sure because of luck of transactions and ACID in mongodb. Wh...

When does MongoDB close persistent DB connections?

I ran a few queries w/ the persistent option turned on. I now have a maximum of 8 connections opened (view from the HTTP interface); I was wondering if they'll ever close. Does it hurt to leave all 8 open? ...

MongoDB and CakePHP Model associations

Hi, I'm trying to make a Match model which includes the players lined up during that match. So each Match hasMany Players and each Player hasmany Matches. match = { '_id' : ObjectID('978tqwbi9873gofiu'), 'home' : 'Argentina', 'away' : 'Brazil', 'lineup-home' : [ {'name' : 'Lionel Messi', 'goals' : '2', 'timeon' : 30 }...

MySQL export to MongoDB

I am looking to export an exist MySQL database table to seed a Mongo Database. I would have thought this was a well trodden path, but it would appear not, as i am coming up blank with a simple MySQLDUMP -> MongoDB JSon convertor. It won't take much effort to code up such a conversion utility. ...

Ruby on Rails fails to connect to Mongodb locally using MongoMapper

Hey, I'm very new to rails and have been trying to experiment with using Mongodb on a web app. I have been following this railscast tutorial here word for word and have been running into issues with it not connecting to my local Mongodb. I'm sure Mongodb is up and running since mongod shows up in my activity monitor and going to ht...

So... this NoSQL thing...

I've been looking at MongoDB and I'm fascinated. It appears (although I have to be suspicious) that in exchange for organizing my database in a slightly different way, I get as much performance as I have CPUs and RAM for free? It seems elegant, and flexible, but I'm not trading that for fast like I am with Rails. So what's the catch? Wha...

Launch MongoDB with Maven

I am using the MongoDB Java driver to perform some persistence in my application. The build for my application is managed via Maven and I'm looking for the best way to integrate a series of MongoDB-related unit tests into my Maven build process. I cannot assume that the user building the application has installed the MongoDB dameon as a ...

Business Intelligence and NoSQL

For a new project I'm working I have the need to store some data into a database. The type of data and access model fits well with the NoSQL model and document databases. We are considering things like MongoDB but are still yet undecided. One of the requirements is to be able to allows Business Intelligence tools to consume some of our ...

invalid byte sequence in US-ASCII (Ruby 1.9 + rails 2.3.8 + mongodb + mongo_mapper)

My setup is: linux + Ruby 1.9 + rails 2.3.8 + mongodb + mongo_mapper I followed http://railscasts.com/episodes/194-mongodb-and-mongomapper, that everything is OK first. I can insert English strings successfully, but when I insert some Chinese strings, it inserted, but can't be displayed. The web page shows an exception: invalid byte ...

MongoDB - simulate join or subquery

I'm trying to figure out the best way to structure my data in Mongo to simulate what would be a simple join or subquery in SQL. Say I have the classic Users and Posts example, with Users in one collection and Posts in another. I want to find all posts by users who's city is "london". I've simplified things in this question, in my real...

MongoDB - help with a PHP query

Hi guys, I have the following object stored in a MongoDB: [_id] => MongoId Object ( ) [horses] => Array ( [0] => Array ( [name] => Youve Been Mowed [selectionId] => 3004097 ) [1] => Array ( [name] => Rascal In The Mix [selectionId] => 3460932 ) [2] => Array ( [name] => Clumber...