mongodb

How to use binary operators (& or |) with mongodb in ruby on rails

Have you guys ever saved your information with binary masks to improve performance? This is my case and I am also using mongodb with rails to store and retrieve it. I've used a pair of scopes using '&' and '|' to retrieve users with specific roles, but each time I run those scopes I get all the users regardless the roles... how could I ...

Pure Python implementation of MongoDB?

Looking around for a noSQL database implementation that has an ORM syntax (pref. like Django's), lets me store and retrieve nested dictionary attributes but written entirely in Python to ease deployment and avoids Javascript syntax for map/reduce. Even better if it has a context-aware (menus), python-based console, as well as being able ...

Which best fits my needs: MongoDB, CouchDB, or MySQL. Criteria defined in question.

Our website needs a content management type system. For example, admins want to create promotion pages on the fly. They'll supply some text and images for the page and the url that the page needs to be on. We need a data store for this. The criteria for the data store are simple and defined below. I am not familiar with CouchDB or M...

When is preferred to use a standard index instead of a background index in MongoDB?

MongoDB 1.6 allows to define indexes to be run as background operations. Background indexes seems to be a little slower, but doesn't block other write/read operations so they seems to be the best choice when you need to create indexes on databases already populated with some data. However, even with empty collections, background indexes...

MongoDB Stored Procedure Equivalent

Hello, I have a large CSV file containing a list of stores, in which one of the field is ZipCode. I have a separate MongoDB database called ZipCodes, which stores the latitude and longitude for any given zip code. In SQL Server, I would execute a stored procedure called InsertStore which would do a look up on the ZipCodes table to get ...

Storing a collection of IWhatever in MongoDB via NoRM

I'm having a very hard time getting this working; not even totally sure that it's possible. Let's imagine a simple scenario: class Employee { List<ITask> Tasks {get;set;} } And say we have two different implementations of tasks. If I want to save the Employee object in MongoDB as a single document (the right way to do it I think)...

How to remove attribute from MongoDb Object?

I have added MiddleName attribute to my Customer object. Customer is a simple Object() instance. I want to remove this attribute from my object. How can I do that? I am using MongoDb interactive Console. ...

MongoDB Bound Queries: How do I convert mile to radian?

Hello, I have a collection of stores with a geospacial index on the location propery. What I am trying to do is given the user's latitude, latitude and a search radius (mi), I want to return the list of stores that are within those parameters. I saw the following example on the MongoDB documentation (http://www.mongodb.org/display/DOC...

MapReduce returns NaN

Hi, I have a M/R function, and I get NaN as a value for some of the results. I dont have any experience with JS. Im escaping JS using Java Drivers. String map = "function(){" + " emit({" + "country: this.info.location.country, " + "industry: this.info.industry}, {count : 1}); }"; String reduce = "function(key, ...

Map Reduce count number of documents in each minute MongoDB

I have a MongoDB collection which has a created_at stored in each document. These are stored as a MongoDB date object e.g. { "_id" : "4cacda7eed607e095201df00", "created_at" : "Wed Oct 06 2010 21:22:23 GMT+0100 (BST)", text: "something" } { "_id" : "4cacdf31ed607e0952031b70", "created_at" : "Wed Oct 06 2010 21:23:42 GMT+0100 (BST)",...

Is there a tool like phpMyAdmin for MongoDB databases?

I'm looking for a tool that will provide a clean web interface to access a MongoDB database, and execute/build queries, modify, dump, etc. the data in the collections on the server. The biggest feature I could think of would be a clean way to view the data in the collection. Basically, I want to find a phpMyAdmin style tool that works ...

Mongorestore of a db causing me trouble

Hi, I'm new to MongoDB and I have hard time to backup my local DB and restore it on my server. I found the link on Mongo's website : http://www.mongodb.org/display/DOCS/Import+Export+Tools but I still have problems with the restore. When I do my backup I call mongodump --db Gen Then I see that all the collections are dump in /bin/d...

Implementing Bi-Directional relationships in MongoEngine

I'm building a Django application that uses MongoDB and MongoEngine to store data. To present a simplified and version of my problem, say I want to have two classes: User and Page. Each page should associate itself with a user and each user a page. from mongoengine import * class Page(Document): pass class User(Document): name...

Connecting to MongoDB from MATLAB

I'm trying to use MongoDB with MATLAB. Although there is no supported driver for MATLAB, there is one for Java. Fortunately I was able to use it to connect to db, etc. I downloaded the latest (2.1) version of jar-file and install it with JAVAADDPATH. Then I tried to follow the Java tutorial. Here is the code javaaddpath('c:\MATLAB\myJ...

Creating Thumbnails with GridFS + MongoDB + PHP

I'm creating a site where a client who will be selling his photography which he sells a lot of it and will probably get quite a bit of traffic. Probably around 2k-5k uniques a day. I'm using MongoDB with PHP and I read i should use GridFS to store these large files. Upwards of 2MB-5MB photos, but obviously BW will be extremely spendy (im...

How Do I Create a JSON Feed from a MongoDB Collection

I'm creating a CMS for my client to work with his photographs and to sell them on his site. For the CMS end as well as the front end, which both will be all AJAX, it'd be nice to get a JSON feed setup so that I can just use the same feed to generate new "pages" and "views" with JS. So this example feed would have like {[name:'A Photo',d...

Nube with nodejs and mongodb

Hi there! I made a simple db with a few users in it with mongodb and nodejs. Next im looping through the list and display the users in the list's names etc with sys.puts(). No I am adding the users to an Array() like this: db.open(function(err, db) { db.collection('users', function(err, collection) { collection.find({}, {'...

MongoDB's geospatial index: how fast is it?

I'm doing a where in box query on a collection of ~40K documents. The query takes ~0.3s and fetching documents takes ~0.6 seconds (there are ~10K documents in the result set). The documents are fairly small (~100 bytes each) and I limit the result to return the lat/lon only. It seems very slow. Is this about right or am I doing somethi...

How to reference an embedded document in Mongoid?

Using Mongoid, let's say I have the following classes: class Map include Mongoid::Document embeds_many :locations end class Location include Mongoid::Document field :x_coord, :type => Integer field :y_coord, :type => Integer embedded_in :map, :inverse_of => :locations end class Player include Mongoid::Document ...

How to create user accounts in MongoDB?

I wonder what's 'correct' way to create user accounts in MongoDB and actions like register/login. Do I have to create a specific collection for users (Username,Email,Password) or MongoDB has something built in already for users? If I have to create users collection manually, how to deal with password encryption? Thanks. ...