mongodb

Mongo Shell - Console/Debug Log

Probably a dumb question. Experimenting with Mongo shell. I want to do something like: matt@linuxvm:~/mongodb-linux-i686-1.2.3/bin$ ./mongo MongoDB shell version: 1.2.3 url: test connecting to: test Thu Feb 25 20:57:47 connection accepted from 127.0.0.1:37987 #3 type "help" for help > function test() { debug.log("hello") } > test() Thu...

Relations in Document-oriented database?

I'm interested in document-oriented databases, and I'd like to play with MongoDB. So I started a fairly simple project (an issue tracker), but am having hard times thinking in a non-relational way. My problems: I have two objects that relate to each other (e.g. issue = {code:"asdf-11", title:"asdf", reporter={username:"qwer", role:"ma...

How to remove a reference in mongodb?

I have the following object { "_id" : ObjectId("4b8699aa3b97dc29dd000000"), "name" : "test", "email" : "test", "url" : "test", "items" : [ { "$ref" : "item", "$id" : ObjectId("4b866a043b97dc22a9000001") } ]}...

MongoDB Many-to-Many Association

How would you do a many-to-many association with MongoDB? For example; let's say you have a Users table and a Roles table. Users have many roles, and roles have many users. In SQL land you would create a UserRoles table. Users: Id Name Roles: Id Name UserRoles: UserId RoleId How is same sort of relationship ...

MongoDB Alternative Design

Since it's really not possible to return a single embedded document (yet), what is a good database design alternative? Here is a situation. I have an object First. First has an array of Second objects. Second has an array of Third objects. db.myDb.findOne() { "_id" : ObjectId("..."), "Seconds" : [ { "Second ...

C# MongoDb Driver Question Update Failing

Here is the situation. I am inserting a new post and after insert I fetch the post and it works fine. Then I change one field and update which works fine. The problem occurs when I try to fetch the same post after the update. It always returns null. public class Post { public string _id { get; set; } ...

Requesting advice on persisting objects from a dynamic language to a document database

Hi, Do you have any insights into the most elegant way of persisting objects from a dynamic language in a document database? I have a solid background in C# and have just started programming in Python. At the same time I am trying to learn the ropes of MongoDB. Now I am wondering: what is the most elegant way to persist my data to t...

Howto use mongoDB bindings for haskell.

Hello, I am pretty new to Haskell but I feel like I have a decent understanding over all. I'm currently trying to play with the unofficial mongoDB bindings for haskell. If you look at the code here: http://github.com/srp/mongoDB/blob/master/Database/MongoDB.hs connect :: HostName -> [ConnectOpt] -> IO Connection connect = flip conn...

Return embedded documents in query

Is it possible to perform a query and return the embedded documents? Currently, I have: class Post include MongoMapper::Document many :comments end class Comment include MongoMapper::EmbeddedDocument belongs_to :post key :author key :date key :body end Here is a query that is almost there: Post.all("comments.date" ...

pymongo: problem with findandmodify - "no such command" is returned

I believe there is a bug in pymongo (or, at least, the documentation) which makes it impossible to run a findandupdate query. Here's what happens. When I run: result = db.command({ 'findandmodify': 'my_collection', 'query': {'foo': 'bar'}, 'update': {'$set': {'status': 'queued'}}, }) The query that act...

How do I perform the SQL Join equivalent in MongoDB?

How do I perform the SQL Join equivalent in MongoDB? For example say you have two collections (users and comments) and I want to pull all the comments with pid=444 along with the user info for each. comments { uid:12345, cid:444, comment="blah" } { uid:12345, cid:888, comment="asdf" } { uid:99999, cid:444, comment="qwer" } user...

Design a document database schema

I'm vainly attempting to learn how to use object databases. In database textbooks the tradition seems to be to use the example of keeping track of students, courses and classes because it is so familiar and applicable. What would this example look like as an object database? The relational database would look something like Student ...

What's the difference between "Replica-Pairs" and "Master-Master" replication in MongoDB?

Given that MongoDB describes Replica-Pairs replication as ...databases automatically coordinate which is the master and which is the slave at a given point in time. At startup, the databases will negotiate which is master and which is slave. Upon an outage of one database server, the other will automatically take ov...

Several operations inside of a single MongoDB query

Is it possible to alter more than one collection in a single query with MongoDB? A SQL example: begin update table_1 set some_field=1; update table_2 set a_different_field=2; commit ...

Can you query MongoDB for any properties with a given value?

I'm beginning to play around with MongoDB and I'm wondering if it's possible to query the datastore for any property with a particular value. So instead of: db.foo.find({'color':'red'}) I'm looking to see if you can do something like: db.foo.find({'%':'red'}) Is that possible? Is there a syntax for wildcarding the property slot? I...

Strings or Floats?

I have a list of product edition serial numbers to store in MongoDB, eg, [{"name": "123 > Item A", "serial_number": "123.1"}, {"name": "123 > Item B", "serial_number": "123.2"}, {"name": "123 > Item C", "serial_number": "123.3"}, {"name": "123 > Item D", "serial_number": "123.4"}, {"name": "124 > Item A", "serial_number": "124.1"}] ...

Is mongodb fit for sites like stackoverflow?

is mongodb appropriate for sites like stackoverflow? ...

logging apache2 to mongodb: apache hook? something out there?

i just found a great blog posting on http://simonwillison.net/2009/Aug/26/logging/ stating the following MongoDB is fantastic for logging". Sounds tempting... high performance inserts, JSON structured records and capped collections if you only want to keep the past X entries. If you care about older historic data but still...

MongoDB Concurrency

I'm a little confused about MongoDB's read locking. How many concurrent read operations can a single collection support? ...

Write-only collections in MongoDB

I'm currently using MongoDB to record application logs, and while I'm quite happy with both the performance and with being able to dump arbitrary structured data into log records, I'm troubled by the mutability of log records once stored. In a traditional database, I would structure the grants for my log tables such that the application...