Questions tagged [moped]
62 questions
1
vote
2 answers
Mongoid Moped query not returning the same as the MongoDB shell
Creating a query using Mongoid 3.1.5 and MongoDB 2.4.9 I get different results from the Mongoid/Moped query that I do from the equivalent MongoDB query.
Update added Mongoid query
The query in its long for is:
return Video.order_by(release_date:…

pferrel
- 5,673
- 5
- 30
- 41
1
vote
1 answer
Mongoid / Moped update an embedded document - ArgumentError - wrong number of arguments (2 for 1)
I'm having trouble updating an embedded document in a Ruby / Sinatra app. I'm trying to use the positional operator "$" in an update statement in order to select the correct document from the embedded array. But this is throwing an "ArgumentError -…

user2748791
- 25
- 4
1
vote
1 answer
Mongoid Moped could not resolve IP address for... remote MongoDB
I can connect just fine to a local MongoDB, but when I try connecting to either MongoHQ or DotCloud instance using Ruby Mongoid, then I get the above error message.
I'm using Ruby 1.9.3 and Moped 1.5.2.
I can connect to MongoHQ and DotCloud DBs…

user2748791
- 25
- 4
1
vote
1 answer
Mongoid/Moped invalid day of month getting saved
I want to have DateTimes with invalid days of the month to be validated. I'm using Mongoid 4alpha2 with Rails 4, and on my model I have a
field :date_of_birth, type: DateTime
When I do a regular "create" from a controller for a date_of_birth with…

tkuichooseyou
- 650
- 1
- 6
- 16
1
vote
1 answer
Moped::Errors::ConnectionFailure: Could not connect to any secondary or primary nodes
I have been trying to configure MongoDB (Mongoid) to work in my Rails application but I am helpless as I have tried pretty much everything I could find online yet I am getting this error message everytime there is a database line in my code. The…

sebkkom
- 1,426
- 17
- 31
1
vote
1 answer
how to show aggregation results on Rails 4
Syntax in mongodb:
db.orders.aggregate(
{$unwind: "$lines"},
{$group :
{_id: {sku: "$lines.sku", desc: "$lines.description"},
qty : {$sum : 1}}},{ $sort : { qty : -1}}
)
I want to to show the…

Askar
- 5,784
- 10
- 53
- 96
1
vote
1 answer
Rails Mongoid select where key/value pair in array
so I have a collection Groups that looks like this
[
{
\"_id\": \"51bdff3968c7c4dd30000003\",
\"members\": [
{
\"id\": \"51bdedef68c7c4bc7c000001\",
\"role\": \"admin\"
},
…

DexCurl
- 1,683
- 5
- 26
- 38
1
vote
2 answers
Best practices for mongoid relations
I am mapping relations in mongoid, I want to know the best practices for mongoid.
Models
Customer
Service
Supplier
there are four different services (S1, S2, S3, S4), each service provided by the specific supplier. How can I map these models or…

bilal ahmad
- 206
- 3
- 9
1
vote
4 answers
Mongoid aggregation $match with Date objects not working?
I have User documents in a collection that have this structure:
{ "_id" : ObjectId( "4fb54ef46d93b33b21003951" ),
"activities" : [
{ "id" : ObjectId( "4fd66f9001e7fe9f03000065" ),
"type" : "checkin",
"date_time_created" : Date(…

JayNCoke
- 1,091
- 2
- 11
- 17
1
vote
1 answer
rspec gives error Moped::Errors::ConnectionFailure
When i run tests rspec, i get error
1) Nimba::Storages DropboxStorages returns http success
Failure/Error: Unable to find matching line from backtrace
Moped::Errors::ConnectionFailure:
Could not connect to a primary node for replica set…

dilshod
- 1,831
- 2
- 12
- 11
1
vote
3 answers
Moped: Rename mongodb collection
How can one rename a collection, using Mongoid + Moped driver?
Is there a Moped implementation of http://docs.mongodb.org/manual/reference/command/renameCollection/?

Vlad Zloteanu
- 8,464
- 3
- 41
- 58
0
votes
1 answer
How do I rename a collection with Mongoid 7.x and MongoDB 3.x
I have a test app using Ruby 2.2.2 and am using Mongoid 7.0.0 and Moped 1.5.3 with MongoDB 3.6.2 - we are upgrading an ancient codebase using Mongoid 4.x and MongoDB 2.6 and found numerous breaking-changes in the API along the way
The most serious…

blue18hutthutt
- 3,191
- 5
- 34
- 57
0
votes
1 answer
Mongo query timeout in Mongoid
How do I set timeouts for my Mongo queries in Mongoid?
I know Mongo supports cursor.maxTimeMS() but could not find it in Mongoid documentation.

PseudoRandomNo
- 11
- 5
0
votes
1 answer
Moped "invalid collection name"
I've recently upgraded mongoid to version 3.0.0 from 2.0 in my rails app.
When performing an operation which saves an object (either existing or a new one) I'm getting Moped::Errors::OperationFailure: The operation: #

jacobi007
- 11
- 3
0
votes
1 answer
intermittent "Moped::Protocol::Command failed with error nil" errors in Resque workers
I'm using Rails 3.2, Mongoid 3.1.7, Moped 1.5.3, and Resque 1.24.1
I'm repeatedly getting "Moped::Protocol::Command failed with error nil" [1] errors in my Resque workers.
This issue, and this one in the Moped repo make me think this is probably…

Bee
- 14,277
- 6
- 35
- 49