开发者

MongoDB keeps querying namespaces

开发者 https://www.devze.com 2023-03-31 11:31 出处:网络
In my rails app I\'m using mongoid and in the logs before pretty much every query, even on the same request, it also does

In my rails app I'm using mongoid and in the logs before pretty much every query, even on the same request, it also does

MONGODB dbname['system.namespaces'].find({})

What is this doing? Is this a performance concern? Can I somehow cache so it doesn't have to do this all the time or at least stop it from clogging up the logs?

Edit: Here's the relevant portion of the log

Processing by FilesController#new as HTML
Started GET "/" for 127.0.0.1 at Fri Sep 09 15:59:43 -0700 2011
[Barista] Compiling all scripts for barista
[Bari开发者_运维百科sta] Compiling all coffeescripts
[Barista] Copying all javascripts
MONGODB db['system.namespaces'].find({})
MONGODB db['users'].find({:_id=>BSON::ObjectId('4e6a949935d3e9726b000001')})
MONGODB db['system.namespaces'].find({})
MONGODB db['files'].find({:token=>"nonssb38"})


This happens in Mongoid until 3.0 comes up. Notice that this only happens in development mode, so it's not much of a big deal.

References:

  • https://github.com/mongoid/mongoid/issues/1465
  • https://github.com/mongoid/mongoid/issues/1291


Well its performing an operation on the database so I don't see how its clutter when you have your normal queries in the logs as well. The documentation for MongoDB states that the <dbname>.system.* namespaces keep database related metadata in them.

You most likely cant cache it since its data that may need to be updated on each query as part of some database housekeeping. I'm looking in the source for some concrete answers.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号