Recently, the find () method in tornadomongodbansiblemongodb is awesome. You can upload all the tables in the set. At first I wrote classModule_actionHandler (tornado. web. requestHandler): defget (self, * args, ** kwargs): collself. application. db. waitfishhostscol
Recently, there was a find () method in tornado \ mongodb \ ansible mongodb, which was awesome. You can upload all the tables in the set. At first I wrote class Module_actionHandler (tornado. web. requestHandler): def get (self, * args, ** kwargs): coll = self. application. db. waitfish hosts = col
Recently in tornado \ mongodb \ ansible
The find () method in mongodb is awesome. You can upload all the tables in the set.
class Module_actionHandler(tornado.web.RequestHandler): def get(self, *args, **kwargs): coll = self.application.db.waitfish hosts = coll.find({}, {'hostname':1,"_id":0}) modulenames = ['ping', 'setup', 'copy'] self.render( "module_action.html", hosts = hosts, modulenames = modulenames, )
Then in the template:
{% for host in hosts %} {{ host['hostname'] }} {% end %}
Later I thought about the find () method to find all the tables, which is too much damage ..
So I went to see du Niang again, basically listing a lot of query commands and a lot of methods.
Finally, I chose this one:
Class Module_actionHandler (tornado. web. requestHandler): def get (self, * args, ** kwargs): coll = self. application. db. waitfish hosts = coll. find ({},{ 'hostname': 1, "_ id": 0}) # To explain, Here hostname: 1 indicates that the hostname column is returned, because the _ id column is returned every time, 0 is disabled. The template is also modulenames = ['ping', 'setup', 'copy'] self. render ("module_action.html", hosts = hosts, modulenames = modulenames ,)