3
db.uafiles.find({"operating_system":"Windows XP"},{"is_pc":"True"}) 

Currently I have a record of 15000 user agent details on a collection.When I'm trying to query, I got only 20 items from the collection.What query would it make me to list the entire items ?

styvane
  • 59,869
  • 19
  • 150
  • 156
Arun
  • 1,160
  • 3
  • 17
  • 33
  • may change query as `.find({"operating_system":"Windows XP","is_pc":"True"})`. And check `"True"` string or `Boolean true` – Neo-coder Jul 15 '15 at 10:34
  • @yogesh this will not work since OP wants to return all documents that match the query. – styvane Jul 15 '15 at 10:51
  • @user3100115 I think problem with query because if query return all matched documents then mongo shell default shows `it` to iterate over more results like `has more` – Neo-coder Jul 15 '15 at 10:55
  • for example if you do `DBQuery.shellBatchSize = db.collection.count()` in the shell before `db.collection.find()` you have no `it` because it return every document in your collection and that is what OP wants – styvane Jul 15 '15 at 10:59

1 Answers1

1

You need to set the DBQuery.shellBatchSize attribute value in order to change the number of iteration which basically corresponds to the number of returned document. more info here

For example to return the 100 documents use

DBQuery.shellBatchSize = 100

To return all documents that match your query criteria use:

DBQuery.shellBatchSize = db.uafiles.count({ "operating_system": "Windows XP" }, { "is_pc": "True" })

Then:

db.uafiles.find({ "operating_system":"Windows XP" }, { "is_pc": "True" }) 

But why will you want to do that since typing it returns the next 20 documents if any.

styvane
  • 59,869
  • 19
  • 150
  • 156