我有两个集合,我想为变量分配两个空格:
okbooks = db.downloaded_book_status.find({status:"OK"}).count()
errorbooks = db.downloaded_book_status.find({status:"ERROR"}).count()
然后打印
result = 'OK:'+okbooks+' | ERROR:'+errorbooks
但每次我分配变量处理打印查询结果时。我想打印结果。如果有可能这样做吗?
答案 0 :(得分:0)
你可以尝试:
okbooks = db.downloaded_book_status.count({status:"OK"})
errorbooks = db.downloaded_book_status.count({status:"ERROR"})
答案 1 :(得分:0)
最后我将其更改为:
result = 'OK:'+db.downloaded_book_status.find({status:"OK"}).count()
+' | ERROR:'+db.downloaded_book_status.find({status:"ERROR"}).count()
而不是传递变量我传递查询。