Trying to insert into a mongodb database from scala. the below codes dont create a db or collection. tried using the default test db too. how do i perform CRUD operations?
object Store {
def main(args: Array[String]) = {
def addMongo(): Unit = {
var mongo = new Mongo()
var db = mongo.getDB("mybd")
...
So I have done some research and found out that MongoDB doesn't do fsync(), which means that when you tell the database to write something, the database might tell you it's written, although it's not. Isn't this going against CRUD?
If I'm correct, are there any good reasons for this?
...
I wonder if MongoDB and CouchDB could work as database for mobile devices?
If they both can, which one is better to use for online/offline storage?
...
I want to store some genomic positions (chromosome,position) using MongoDB.
something like:
{
chrom:"chr2",
position:100,
name:"rs25"
}
I want to be able to quickly find all the records in a given segment (chrom , [posStart - posEnd]). What would be the best key/_id to be used ?
a chrom , position object ?
db.snps.save({_id:{chrom...
I have read a lot of the MongoDB.
I like all the features it provides, but I wonder if it's possible to have it as the only database for my application, including storing sensitive information.
I know that it compromises the durability part in ACID but I will as a solution have 1 master and 2 slaves in different locations.
If I do tha...
Hey,
If my data is relational (publishers-authors-books, associations-teams-players), can we use NoSQL system like HBase or MongoDB to store the data?
(I know it may sound like a stupid question but I'm just learning :))
...
In CouchDB you always have to use map reduce to query results.
In MongoDB you can their query methods for retrieving data, but they also let you do map-reduce.
I wonder, when do I actually need map-reduce?
Are those query methods different from map-reduce or are they just wrappers for map-reduce functions?
...
Let's say I start with replica sets and each mongo server has a 500G hard disk attached to each one. What happens if my data grows beyond 500G? I assume that's where sharding comes into play? In addition, I keep reading that in order to gain optimal performance, you would want to keep your indexes in memory. So if my index is 100G, does ...
In MongoDB you have a lot of helper methods that do all the basic operations for you:
count
sort
update
replace
etc...
In CouchDB you ahve to write map-reduce for everything by hand for basic operations?
...
Hi,
what are the methods/drivers i can use to perform CRUD operations? Atm, i am only successful with the Create function, ie
DBObbject.put("field","value")
Common sense suggests that find() should stand for retrieve, but using it gives the following error
value find is not a member of com.mongodb.BasicDBObject
All and any help ap...
Assuming a setup like this:
blogposts
{
title:"Example",
slug:"example-post"
tags: ["foo", "bar"]
},
{
title:"Example2",
slug:"example2"
tags: ["foo"]
}
news
{
headline: "Test"
slug: "test-news"
tags: ["bar"]
}
I know I can get all the blog posts with a specific tag:
$cursor = $blogposts->find(array('tags' => 'bar'...
I've found this:
function: http://github.com/timburks/NuMongoDB/blob/master/src/bson.c#L128
bytes: http://github.com/timburks/NuMongoDB/blob/master/src/platform_hacks.h#L55
struct: http://github.com/timburks/NuMongoDB/blob/master/src/bson.h#L70
But how exactly would I use this for my iPhone app that gets the oid as a string from the se...
I'm running this code:
$db = new Mongo("mongodb://user:[email protected]:27081/dbname");
$collection = $db->foobar;
$collection->insert($content);
I'm trying to test mongohq by just creating a random collection.
I'm getting this error:
Fatal error: Call to undefined method MongoDB::insert() in /ajax/db.php on line 2...
Hi all,
we have a eMall application based mainly around a ~500k rows MySQL master table (with detail tables storing non searchable fields and other related tables with shop info etc).
Users can today search based on specific structured product data (e.g. brand, category, price, specific shop etc).
We would also like to support keyword...
Hi, I'm looking for some recommendations on how to structure the tags part of this data model:
Here's a simplified version of it:
a Site has many Posts (relational association [references_many in mongoid speak]). A Site has a tree of tags
a Post has an array of tags (subset of the Site's tags, order doesn't matter)
The use cases I...
The following line works:
Analytic.collection.map_reduce(map, reduce).find
but is there a way to do
Analytic.collection.find('page_type' => 'products').map_reduce(map, reduce).find
and even filter a date range such as date >= "2010-08-01" and date <= "2010-08-31"?
...
I think explain() will tell any possible index it can use. How about just showing all the indexes defined on the collection? (or even for the whole db?)
...
If there is an index on
page_type, our_id, date
and when querying,
db.analytics.find({page_type: 'ingredients', ga_date:
{$gte : new Date('Wed Sep 08 2010 12:00:00 GMT-0800')}})
db.analytics.find({page_type: 'ingredients', ga_date:
{$gte : new Date('Wed Sep 08 2010 12:00:00 GMT-0800')}}).explain()
if our_id is omitted, or da...
If the following is used
Analytic.collection.map_reduce(map, reduce,
:query => {:page => subclass_name},
:sort => [[:pageviews, Mongo::DESCENDING]]).find.to_a
it won't sort by pageviews. Alternatively, if it is array of hash:
Analytic.collection.map_reduce(map, reduce,
:query => {:page => subclass_name},
:sort => [{:page...
Lets say we have a simple model that stores two integers, the min and the max. We would like to force min <= max.
class MinMax
include MongoMapper::Document
key :min, Integer
key :max, Integer
validate_presence_of :min, :max
end
1) How would you validate that min is indeed equal or less than max?
2) If you don't think this ...