FAQ
Here's a dump of stuff that's going on. First the commands from a Rails
console followed by what the log shows me:
Model.first.some_date
=> nil
Model.all.update(some_date: Time.now)
=> nil
Model.first.some_date
=> nil
Model.with(safe: true).all.update(some_date: Time.now)
=> {"updatedExisting"=>false, "n"=>0, "connectionId"=>11, "err"=>nil,
"ok"=>1.0}
Model.first.some_date
=> nil
Model.collection.find().update_all(:$set => { some_date: Time.now})
=> nil
Model.first.some_date
=> Tue, 05 Jun 2012 15:52:36 +0000

MOPED: localhost:27017 COMMAND database=admin command={:ismaster=>1}
(0.0ms)
MOPED: localhost:27017 COMMAND database=admin command={:ismaster=>1}
(0.0ms)
MOPED: localhost:27017 QUERY database=db_development
collection=models selector={"$query"=>{}, "$orderby"=>{"_id"=>1}} flags=[]
limit=-1 skip=0 fields=nil (0.0ms)
MOPED: localhost:27017 UPDATE database=db_development
collection=models selector={"$query"=>{}, "$orderby"=>{"_id"=>1}}
update={"$set"=>{:some_date=>2012-06-05 08:58:51 -0700}} flags=[:multi]
(0.0ms)
MOPED: localhost:27017 QUERY database=db_development
collection=models selector={"$query"=>{}, "$orderby"=>{"_id"=>1}} flags=[]
limit=-1 skip=0 fields=nil (0.0ms)
MOPED: localhost:27017 UPDATE database=db_development
collection=models selector={"$query"=>{}, "$orderby"=>{"_id"=>1}}
update={"$set"=>{:some_date=>2012-06-05 08:58:51 -0700}} flags=[:multi]
COMMAND database=admin
command={:getlasterror=>1, :safe=>true} (0.0ms)
MOPED: localhost:27017 QUERY database=db_development
collection=models selector={"$query"=>{}, "$orderby"=>{"_id"=>1}} flags=[]
limit=-1 skip=0 fields=nil (0.0ms)
MOPED: localhost:27017 UPDATE database=db_development
collection=models selector={} update={:$set=>{:some_date=>2012-06-05
08:58:51 -0700}} flags=[:multi] (0.0ms)
MOPED: localhost:27017 QUERY database=db_development
collection=models selector={"$query"=>{}, "$orderby"=>{"_id"=>1}} flags=[]
limit=-1 skip=0 fields=nil (0.0ms)
Model.count
=> 1
Model.with(safe: true).all.delete
=> 1
Model.count
=> 1
Model.all.delete
=> 1
Model.count
=> 1
Model.with(safe: true).delete_all
=> 1
Model.count
=> 0

MOPED: localhost:27017 COMMAND database=admin command={:ismaster=>1}
(0.0ms)
MOPED: localhost:27017 COMMAND database=admin command={:ismaster=>1}
(0.0ms)
MOPED: localhost:27017 COMMAND database=db_development
command={:count=>:models, :query=>{}} (0.0ms)
MOPED: localhost:27017 COMMAND database=db_development
command={:count=>:models, :query=>{}} (0.0ms)
MOPED: localhost:27017 DELETE database=db_development
collection=models selector={"$query"=>{}, "$orderby"=>{"_id"=>1}} flags=[]
COMMAND database=admin
command={:getlasterror=>1, :safe=>true} (0.0ms)
MOPED: localhost:27017 COMMAND database=db_development
command={:count=>:models, :query=>{}} (0.0ms)
MOPED: localhost:27017 COMMAND database=db_development
command={:count=>:models, :query=>{}} (0.0ms)
MOPED: localhost:27017 DELETE database=db_development
collection=models selector={"$query"=>{}, "$orderby"=>{"_id"=>1}} flags=[]
(0.0ms)
MOPED: localhost:27017 COMMAND database=db_development
command={:count=>:models, :query=>{}} (0.0ms)
MOPED: localhost:27017 COMMAND database=db_development
command={:count=>:models, :query=>{}} (0.0ms)
MOPED: localhost:27017 DELETE database=db_development
collection=models selector={} flags=[]
COMMAND database=admin
command={:getlasterror=>1, :safe=>true} (0.0ms)
MOPED: localhost:27017 COMMAND database=db_development
command={:count=>:models, :query=>{}} (0.0ms)

The only thing I saw of particular interest, and I should have included it
yesterday since I noticed it then too was this:
Model.with(safe: true).all.update(some_date: Time.now)
=> {*"updatedExisting"=>false*, "n"=>0, "connectionId"=>11, "err"=>nil,
"ok"=>1.0}

That's what lead me to believe it might be a configuration setting
somewhere.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 4 of 6 | next ›
Discussion Overview
groupmongoid @
categoriesmongodb, rubyonrails
postedJun 4, '12 at 9:34p
activeJun 5, '12 at 4:20p
posts6
users2
websitemongoid.org
irc#mongoid

2 users in discussion

Cult hero: 4 posts Durran Jordan: 2 posts

People

Translate

site design / logo © 2022 Grokbase