Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB keeps querying namespaces

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
[Barista] 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"})
like image 734
jhchen Avatar asked Aug 30 '11 04:08

jhchen


2 Answers

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
like image 176
Pedro Nascimento Avatar answered Nov 09 '22 05:11

Pedro Nascimento


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.

like image 41
Devin M Avatar answered Nov 09 '22 05:11

Devin M