Tagged Questions
0
votes
1answer
16 views
Unable to perform a covered (indexOnly) query with mongoid
I have a query built around a composite index, and I've verified from the mongo shell that this query can run as an index only query.
Output:
db.merchants.find({st:{"$regex" : "cr", "$options": ...
0
votes
1answer
32 views
How to select all records where related collection is empty with Mongoid
I'm still getting the hang of MongoDB and Mongoid and have hit this snag.
Let's say I have a User that has_and_belongs_to_many items and of course an Item that has_and_belongs_to_many users.
I'd ...
0
votes
1answer
32 views
Mongoid batch insert with complicated schema?
I've been going all over the web looking for a solution to my problem. I' m using Mongoid to write a set of data to MongoDB.
I'm trying to do a batch insert with mongoid as follows:
class Geonode
...
0
votes
1answer
21 views
Mongoid strange query result
I'm using MongoDB through Mongoid with Rails 3 and observe this strange behavior when doing query in rails console:
> Table.where(:field => {"$exists" => true}).count
=> 3735
> ...
0
votes
3answers
146 views
undefined method `paginate' for Array on Rails 3 with mongoid
Trying to use will_paginate gem.
My Gem file has:
gem 'will_paginate', '~> 3.0.0'
My orders_controllers.rb:
def index
@orders = Order.all.paginate(:page => params[:page], :per_page ...
0
votes
1answer
24 views
Retrieve an embedded document using Mongoid
I have a Mongoid document called Equipment which can embed multiple Question documents. Here are the document schemas:
class Equipment
include Mongoid::Document
include Mongoid::Timestamps
...
1
vote
3answers
277 views
MongoDB/Mongoid: search for documents matching first item in array
I have a document that has an array:
{
_id: ObjectId("515e10784903724d72000003"),
association_chain: [
{
name: "Product",
id: ...
0
votes
0answers
25 views
Best way to implement subset of relation in rails with mongoid?
I have three models in a rails application:
Class Member
include Mongoid::Document
has_and_belongs_to_many :organizations, inverse_of: :members
has_and_belongs_to_many :orgadmin, inverse_of: ...
0
votes
1answer
29 views
Rails app with Mongoid not saving on update
I'm making a Rails app that uses Mongoid and devise. Currently, the functionality's pretty basic, but it's not working like I expect it to. In particular, update isn't working at all.
I can create a ...
0
votes
0answers
25 views
How to measure the physical size of a query of documents in Mongo
I want to be able to measure the amount of data each of my users store. I have abstracted all the storage items to use STI so I only need to query from one table, I was hoping there was a way to ...
0
votes
0answers
37 views
Duplicate Documents in MongoDB
I'm running into an issue where I'm sporadically having duplicate documents inserted into my MongoDB collection. It's only happened a handful of times and, in all cases, the duplicates are created ...
0
votes
1answer
63 views
Nested Querying in Mongoid in 2013
So this question is two years old:
Querying embedded objects in Mongoid/rails 3 ("Lower than", Min operators and sorting)
and the way it recommends to query nested objects with less than ...
1
vote
0answers
51 views
MongoDB/Mongoid Tree Structure
I'm currently speccing out the architecture for a project. Its on a fairly tight timeline, will need to support a few hundred thousand users fairly soon after launch, and its business logic and model ...
2
votes
0answers
112 views
Rails blog using Mongoid - Auto generate Short URL on post creation
I have a simple blog engine using Rails and Mongoid ORM.
I have 2 models in the blog, 'Article' and 'Url'.
The Article model contains all of the post content, and the Url class is the generator ...
0
votes
1answer
115 views
Ruby on Rails + MongoDB and MongoID
I have created a sample DB with MongoDB with data from a JSON file on mongodbs website
I have imported it with the following command.
mongoimport --db test --collection zips --file zips.json
The data ...