Batch insert/update using Mongoid?
I googled and all others, but I didn't find the answer. The question is: Hi, how can I do batch insert with Mongoid to MongoDB? ...
I googled and all others, but I didn't find the answer. The question is: Hi, how can I do batch insert with Mongoid to MongoDB? ...
I am using MAMP and would like to use mongo with PHP. I am stuck because the version of MAMP I'm using is the latest version I can find, and it's running PHP 5.2.11. The only Mongo PHP install I can find for OSX is for PHP 5.3. Is there any way to get mongo working with PHP using MAMP? ...
I seem to be having some trouble using the cursor as I try to pull data out of a MongoDB. Here is a screenshot of my simple data structure: I'm trying to use the following: $collection_name = "users"; $collection = $this->mongo->db->$collection_name; $which_document = array("email" => $email_address); $which_fields = array("words"); ...
The idea is to do analytics of 30 or 2000 products out of a collection of 80,000 products. Say, if there are 80,000 products, and to get the top products with highest number of pageviews in a category, which can include only 30 or up to 2000 products, so we can either filter out all those products first, and then use map/reduce to find ...
For example, when doing Analytics, there can be a map/reduce run that takes 10 seconds. After it is run, if other webpages can make use of that result, then it will be saving 10 seconds per page. It will be good to have the map/reduce result cached somehow. It is possible to record a sucessful map/reduce run as map_reduce_result_[time...
I've seen some using strings, int timestamps and some mongo datetime objects. ...
Is it true that Map/Reduce results can be stored permanently, but not sorted? For example, coll = Analytic.collection.map_reduce(map, reduce, :out => 'analyticsCachedResult') the above is stored permanently but is not sorted. To sort it on the fly, it can be coll.find({}, :sort => ['value.pa...
Since Mongoid.master.collection() returns a collection even if the collection doesn't exist, we can use coll = Mongoid.master.collection('analyticsCachedResult') if coll.count == 0 # [...] end to test if it is an empty collection. Another method is to loop through Mongoid.master.collections.each do |c| return c if c.name == 'ana...
I have a collection as follows: { "_id" : ObjectId("4c9c63a95d765f996ca8dff4"), "count" : "28", "id" : "5565", "person" : [ { "id" : "5435df", "name" : { "fn" : "abc", "ln" : "xyz" }, "sex" : "m", "location" : { "country" : "india" } }, { ...
I have a list of documents, each with lat and lon properties (among others). { 'lat': 1, 'lon': 2, someotherdata [...] } { 'lat': 4, 'lon': 1, someotherdata [...] } [...] I want to modify it so that it looks like this: { 'coords': {'lat': 1, 'lon': 2}, someotherdata [...]} { 'coords': {'lat': 4, 'lon': 1}, someotherdata [...]} [......
Hello! I am working on a mobile site that lets you search for tags of a MongoDB collection of articles. Basically, each article object has a tags property, which stores an array of tag strings. The search works fine, but I also want to add logging to the searches. The reason is that I want to see what visitors are searching for and wh...
Note: I ended up answering my own question shortly after posting this. Thanks and sorry if you spent time reading my rediculously long post. Introduction I'm sort of a Mongo noob, just trying to get the hang of things here. I am looking at trying to create a hierarchical data structure to which i can add nodes/leaves dynamically. ...
I have been using MongoDB and the Ruby driver and Mongoid, and lines db.things.find({j: {$ne: 3}, k: {$gt: 10} }); just seem so weird and hard to remember. Why not use a parser: db.things.find("j != 3 && k > 10") which can automatically convert to its desired form? (or whatever form it uses internally). ...
I need to create a named scope in Mongoid that compares two Time fields within the same document. Such as scope :foo, :where => {:updated_at.gt => :checked_at} This obviously won't work as it treats :checked_at as a symbol, not the actual field. Any suggestions on how this can be done? Update 1 Here is my model where I have this scop...
I think with SQLite3, at least it doesn't keep any cached page because there is no server and each write will exit SQLite3, so it can't do any caching directly. But when it is MySQL, Postgresql, or MongoDB, there will be a layer which, when the data is thought to be saved already, it is actually in the memory cache of the DBMS... to be ...
Howdie stackoverflow people! So I've been doing some digging regarding these NoSQL databases, MongoDB, CouchDB etc. Though I am still not sure about real time-ish stuff therefore I thought i'd ask around to see if someone have any practical experience. Let's think about web stuff, let's say we've got a very dynamic super ajaxified weba...
I'm trying to set up MongoDB 1.6.3 on my Windows XP SP 3 machine. I've followed the instructions from the MongoDB wiki. I can see the Windows service installed but not started. The path to the executable looks like this: "C:\Tools\mongodb-win32-i386-1.6.3\bin\mongod" --bind_ip 127.0.0.1 --logpath c:/mongodb/logs/mongodb.log ...
Hi, I have a bunch of data from a scientific experiment stored in a MySQL database, but I want to use MongoDB to take advantage of its map/reduce functionality to power some web charts. What is the best way to have new writes to MySQL replicate into Mongo? Some solution where I inspect the binary MySQL log and update accordingly, just...
What is the equivalent cde in Java: var result = collectionName.findOne() println(result.get("name").toString) To elaborate, This is my sample db: { "_id" : ObjectId("4ca039f7a5b75ab98a44b149"), "name" : "kaustubh", "country" : "india" } { "_id" : ObjectId("4ca03a85a12344a5e47bcc5c"), "name" : "rahul", "country" : "pakistan" } { "_id...
I have a mongodb collection that looks something like this: db.scores.insert({"name": "Bob", value: 96.3, timeStamp:'2010-9-27 9:32:00'}) db.scores.insert({"name": "John", value: 98.3, timeStamp:'2010-9-27 9:28:00'}) db.scores.insert({"name": "Bob", value: 99.3, timeStamp:'2010-9-27 9:29:00'}) db.scores.insert({"name": "John", value: 97...