mongoid
26 posts · All topics
- — Implementing Geolocation with a Custom GraphQL Scalar Type in Ruby
How does one return and accept a geolocation type in GraphQL? Something that has a latitude and longitude?
- — Storing Timestamps in MongoDB with Mongoid
Coming from mongoid-locker#57, in which I, too, wasn’t sure whether calling .utc on a timestamp was necessary with Mongoid.
- — Grouping and Aggregating Weekly in MongoDB
Given a collection of events, aggregate their duration weekly. Fill gaps to contain every week since the earliest event.
- — The Mongoid Community Organization
- — Getting Things Done with Mongoid 5
- — First Class Mongoid Queries with Collection Snapshots
Consider two domain models, a Widget and a Gadget.
- — 10 Largest Collections in a MongoDB Database w/ Mongoid
Mongoid.default_session.collections.map do |c| s = Mongoid.default_session.command(collstats: c.name) [c.name, s["size"] + s["totalIndexSize"] ] end.sort_by { |n, s| -s }.ta...
- — Data Corruption Is Most Likely Caused By Your Code And Not Your Database
- — Three DevOps Rake Tasks I Use Daily on Heroku with MongoDB
- — Debugging 'object has no properties' in a MongoDB map/reduce
You got to love debugging JavaScript errors. Here’s one from a MongoDB map/reduce. The operation fails with this:
- — Slow Migration to Mongoid::Slug 2.x
- — Returning a Sample Set from a Mongo Collection w/ Mongoid
module Mongoid class Criteria def sample(n = 1) indexes = (0..self.count-1).sort_by{ rand }.slice(0,n).collect! if n == 1 return self.skip(indexes.firs...
- — Paging and Iterating Over Large Mongo Collections
Sometimes you need to iterate over a large MongoDB collection. The biggest issue is that, by default, cursors timeout after 10 minutes of inactivity. For very large collections ...
- — Grape API Mounted on RACK w/ Static Pages, Tests, JQuery UI, Backbone.js and Even Mongo
Expanding from my previous post on a Grape API mounted on RACK.
- — Paginating w/ Mongoid 2.4.0, MongoMapper and Kaminari
I’ve upgraded our project from Mongoid 2.0.2 to 2.4.0. It took me a few days since our specs raised a couple of real issues. If you’re doing the same, take Mongoid from the tip ...
- — Mongoid 2.0.2, Mongo + bson + bson_ext 1.4.0 and 1.4.1
In the past two days we’ve had hell with our production environment. It started with a general feel of slowness followed by all kinds of alarms going off in the monitoring syste...
- — Sorting Tables in Rails w/ Mongoid
Sorting tables in Rails is a common problem. It must have been done before, right? In fact it has been done so many times that it’s really hard to find anything that “just works...
- — Mongoid Collection Snapshot
Another fine open-source contribution from @aaw, mongoid_collection_snapshot: easy maintenance of collections of processed data in MongoDB with the Mongoid ODM.
- — Storing Server-Side JavaScript Functions w/ Mongoid + Weekly Rollup
I was working on some map/reduce that rolled up daily, weekly and yearly statistics in MongoDB and discovered, to my surprise, that JavaScript Date doesn’t have a getWeek method...
- — Mongoid 2.0.2 Dropped Pagination => Kaminari
I was a bit surprised to see mongoid drop pagination support in 2.0.2 (here and here). It got some people confused (see mongoid#983). In a project that uses will_paginate, this ...
- — Delaying Image Processing on Heroku with delayed_job
There’s a Gem for That Too
- — RoR Win: 'Getting Things Done' with MongoDB Mongoid
- — Mongoid_fulltext: full-text n-gram search for your MongoDB models
- — CarrierWave: Saving Best Image Geometry
I recently needed to find out the geometry of the image being uploaded via CarrierWave. Images come in many different sizes and shapes. What I want is to have a “best” image and...
- — Models look nice, but sometimes you just want to change they way they feel
Mongoid models provide an excellent level of abstraction. Consider a User model.
- — Adding (almost) static pages to your fancy Rails website
So you’ve built the super amazing complicated Rails website. You are serving data from millions of documents from MongoDB, rendering complex objects using HAML and generally doi...
