mongodb

Problem creating more than one Rails app using MongoDB

I properly installed MongoDB and got it running on my OSX. The first app I created using MongDB and Rails3 was titled 'todo". Per the instructions on railscasts, I created a file (config/initilializers/ mongo.rb) and added this line: MongoMapper.database = "todo- #{Rails.env}" Presumably, this created the files that appeared in my ...

Are document databases good for storing large amounts of Stock Tick data?

I was thinking of using a database like mongodb or ravendb to store a lot of stock tick data and wanted to know if this would be viable compared to a standard relational such as Sql Server. The data would not really be relational and would be a couple of huge tables. I was also thinking that I could sum/min/max rows of data by minute/ho...

Querying Data Type of a Field in MongoDB

In MongoDB, using $type, it is possible to filter a search based on if the field matches a BSON data type (see DOCS). For eg. > db.posts.find({date2: {$type: 9}}, {date2: 1}) { "_id" : ObjectId("4c0ec11e8fd2e65c0b010000"), "date2" : "Fri Jul 09 2010 08:25 :26 GMT" } I need a query that will tell me what the actual type of the field i...

Declarative authorization and mongoid

I want to implement declarative authorization with mongoid. But cannot succeeded. It seems like declarative authorization works with ActiveRecord Only. Can I let it work with MOngoid and MongoDB? Any Ideas. ...

What commit styles are available in MongoDB?

In some sense, the default "save" operation appears to be asynchronous in MongoDB. It seems that when a client saves a document, it will typically receive a successful response immediately from the server, even if the operation has not yet been applied to the database (let alone committed to disk). (I'm basing this model for how save()...

Update mongodb document without updating embedded document and vice versa

Hi I have a document with an embedded document in it. I have 2 forms, 1 that updates fields in document and one that updates fields in emdedded docs. They are split into 2 forms as lots of fields in each etc and actually this is just a simple example of the structure of my app. Everywhere else that i reference this data it makes m...

Mongo complex sorting?

Hi, I know how to sort queries in MongoDB by multiple fields, e.g., db.coll.find().sort({a:1,b:-1}). Can I sort with a user-defined function; e.g., supposing a and b are integers, by the difference between a and b (a-b)? Thanks! ...

ruby on rails and mongo

hi, is there a library like mongoid for rails 2.1 ? thanks ...

How to "Group By" with MongoDB

I would like to know if there is anyway I can "group by" my results with MongoDB/Php. This is the code I'm using to display my rows: $count = $col->find(array('order_id' => array('$gt' => '0')))->count(); I need to group them by order_id. Apparently, we cannot do a count() on a group() as find() WORKS: $countfind = $col->find()->co...

NoSQL (MongoDB) vs Lucene (or Solr) as your database

With the NoSQL movement growing based on document-based databases, I've looked at MongoDB lately. I have noticed a striking similarity with how to treat items as "Documents", just like Lucene does (and users of Solr). So, the question: Why would you want to use NoSQL (MongoDB, Cassandra, CouchDB, etc) over Lucene (or Solr) as your "dat...

How many unique ids could MongoDB generate for a single server?

Hi! I'm rather confused right now about exactly how many unique ids MongoDB could generate for a single server. Of course, with multiple servers the server section of their id object would change too, but with a single server the only parts that would change seem to be the pid section (2 digits) and the incrementing section (4 digits). ...

Database design with millions of entry

Suppose there is a messaging system. This system has millions of entry to be sent and get reported and the count is growing by 100K every hour. 2 service accesses db, one is sender, one is reporter. So what would you suggest in order to get maximum performance? How could the db be designed? Also what open source RDBMS would you suggest ...

Searching a working library for rails 2.1.2

Hi, Do you a library like (or the good version of...) Mongoid or MongoMapper working with rails-2.1.2 and mongo 1.0 ? Thanks ...

How to get sorted results in MongoKit?

How can I perform query like: db.articles.find().sort({created_at: -1}).limit(5); in MongoKit driver? Perhaps I'm blind, but I can't find it in manual. I want to retrieve 5 last products ordered by 'created_at'. MongoKit offers to sort result list (it's more then 2000 items) and slice it. It's unaccepable, I want to sort() and limit() o...

Ruby MongoMapper Question about Mapping

I have a MongoDb database called Northwind. The database was created using C# driver. It contains 10-20 rows. Now, I want to get all those rows out from Ruby. I am using MongoMapper but how can I map a Ruby class "Category" to the "Name" field in the document. require 'mongo_mapper' class Category include MongoMapper::Document key :...

Question about MongoDB from a SQL user.

Hi! I have very interested in using MongoDB it seems awesome. But I'm from a totally different school : relational databases. So now I'm wondering how would this case works with MongoDB: Say, I have a table filled with brands and I have another table filled with products. Each products will have a brand. This is very simple to unders...

Caching Array from DB (MongoDB) in Node.js / Express.js

I wanted to add user search auto-complete (like Facebook's) to my Rails app on Heroku, and I chose to write it in Node.js because of the concurrency requirements. The search first pulls a user's friend list (of id's, which include all twitter friends, not just their friends on our site) from Mongo, then searches for users in that list, t...

is it true that Mongo keeps full database in ram?

how much ram needs mongo in comparison with MySQL? ...

MongoId and bson_ext problem: no such file to load -- bson_ext

There is a similar question about 'bson_ext', but it's not work for me. http://stackoverflow.com/questions/2900604/mongomapper-and-bson-ext-problem I'm using Rails 2.3.8 + MongoId 1.9.1. I followed the "installation" page as: gem install mongoid gem install mongo -v=1.0.4 gem install bson_ext -v=1.0.4 In my config/environment.rb, I ...

Rethinking relational many-to-many relationships for MongoDB

I am just starting a new Rails 3 project using Mongoid ORM for MongoDB. There is just one thing I can not get my head around, and that is how to effectively have a many-to-many relationship. Now there is a good chance that I may be approaching this problem wrong, but as far as I know, there is at least two containers in my project that...