I have a data set in MongoDB that involves a large set of emails and I need to be able to add emails to the set and being able to check if certain emails are in the set. I thought of doing with document structure like this:
{'key': 'foo', 'emails':['[email protected]','[email protected]', ...]}
and use $addToSet and $in. But the problem is that ...
There are two classes:
class Person
include Mongoid::Document
field :name
embeds_many :addresses
end
class Address
include Mongoid::Document
field :city
field :street
validates_presence_of :city, :street
end
We can see, we have validated the city and street should be present.
But see following code:
person = Person...
Hello everyone,
i'm kinda new to Doctrine, been using Porpel before..
I'd like to generate model classes from my schema, but the objects will be stored in a mongoDB - thus i don't need/want Doctrine to generate and insert the SQL for those tables.
In Propel there was a handy attribute (skipSql: true) which worked like a charm for ...
I'm looking into way to track events in a django application (events would generally be clicks tied to a specific unique user id).
These events would essentially contain an event type like "click" and then each click event would be assigned to a unique id (many events can go to one id) and each event would have a data set including item...
I'm working in Java with mongodb.
Is there any Mongodb mapper in Java? Like MongoMapper and Mongoid in Rails?
...
Suppose I have some objects in MongoDB:
{
"_id":xxx,
"name":"mike",
"children": [
{"name":"A", "age":3},
{"name":"B", "age": 5}
]
}
If I want to get this "mike" with his children sorted by "age desc", what should I do?
I've looked at Mongoid(in rails), and morphia(in Java), not found th...
I have large amounts of scientific data that I need to store (150 TB+ starting data) and I want to know the best way to store the data (nosql or RDBMS etc...)
Any tips......
James
...
hello,
i have fedora 13, and i have installed httpd,php,mysql using yum.
then downloaded mongodb.
added the extension=mongo.so to my php.ini
restarted httpd
wrote the following code :
<?php
$connect = new mongo();
$db = $connect->data;
$collection = $db->foobar;
$info = array("name" => "wael", "age" => 24);
$collection = insert($info...
I'm writing a mapreduce script for my mongodb database. The computation requires two mapreduce stages. Currently I write to an output collection and then run the second stage on that collection.
Is it possible to chain mapreduce jobs together without having to manually specify the output collection?
...
Imagine I have this object (written with Ruby literals) stored in a MongoDB:
{"tags" => ["foo", "bar"],
"jobs" => [{"title" => "Chief Donkey Wrangler", "tags" => ["donkeys"]}] }
Now, I want to search for objects based on the tags on the first level of data, not the second. I can write a query like this (using the Ruby MongoDB librar...
hi
I have a menu class and that have many menu_items and a menu_item class that is embedded docuemnt.
I can get a specific menu like
menu = Menu.find_by_name("menu 1")
then i want to find and update or create the menu_item that matches a specific category id.
I want to create the menu item if category id is not found in menu items...
This is my tables, the AUTO_INCREMENT shows the size of each:
tbl_clientes:
CREATE TABLE `tbl_clientes` (
`int_clientes_id_pk` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`str_clientes_documento` varchar(255) DEFAULT NULL,
`str_clientes_nome_original` char(255) DEFAULT NULL,
PRIMARY KEY (`int_clientes_id_pk`),
UNIQUE KEY `st...
I know this is a big question and it's not a yes or no answer but we develop web apps and are looking into using MongoDB for our persistence solution. Combining MongoDB with NoRM for object storage.
What I want to ask is what pitfalls have you experienced with switching from SQL to mongo? When is mongo simply not the right solution and ...
The ids in RDBMS's are usually simple integers that go from 0 to whatever number, but typically you can keep them in the 5 digit range so that you can make urls that look like this
myawesomeblog.com/posts/23456
but with mongodb the unique identifiers for each record look like this.
47cc67093475061e3d95369d
and building and app based o...
Hi all,
I'm using a Mongo MapReduce to perform a word-count operation on a bunch of documents. The documents are very simple (just an ID and a hash of words):
{ "_id" : 6714078, "words" : { "my" : 1, "cat" : 1, "john" : 1, "likes" : 1, "cakes" : 1 } }
{ "_id" : 6715298, "words" : { "jeremy" : 1, "kicked" : 1, "the" : 1, "ball" : 1 } }
...
I have a model classes like
public class MyClass extends ReflectionDBObject {
private List<NiceAttribute> attributes;
...
}
public class NiceAttribute extends ReflectionDBObject {
...
}
I create it in a typesafe way, like
List<NiceAttribute> attrs = new ArrayList<NiceAttribute>();
attrs.add(new NiceAttribute());
MyC...
Im having a problem transferring an SQLlite Rails 3 app over to a Mongoid Rails 3 app. In the SQLlite version, I am easily able to include an image upload form (using Paperclip) from one model ('image') within a nested form from another model ('product'). Here's my 'new' product form:
<%= form_for @product, :html => {:multipart => t...
I want to set one of my field as primary key. I am using mongodb as my nosql.
...
I'm using mongodb 1.4.
I want query something as SQL's like.
For an example in SQL:
select * from users where name like '%m%'
How to do the same in mongodb? I can't find a operator for like in the document of http://www.mongodb.org/display/DOCS/Advanced+Queries
...
how can i query the smoothies that has apple in it? thanks! (below is a collection with 3 documents)
_id => 1
name => 'best smoothie'
ingredients => Array
(
[0] => apple
[1] => raspberry
[2] => orange
[3] => banana
)
_id => 2
name => 'summer smoothie'
ingredients => Array
(
[0] => le...