The Query String

The query string contains variables that are used to specify query arguments or indicate the type of query. The primary query variable is the word query. All queries use a JSON-type structure.

A basic example that returns the _id key value pairs for every record in the database is:

http://localhost:2222/?query={},{%22_id%22:1}

If you cut and paste this URL into the Google Chrome browser, you will see a result similar to the following. The number of results varies, depending on the number of records in your data store.

{ "retval" : [ { "_id" : { "$oid" : "4d068547e818f7cba1b63688"}} ,
 { "_id" : { "$oid" : "4d06852ee818f7cb95b63688"}} ,
 { "_id" : { "$oid" : "4d068532e818f7cb97b63688"}} ,
 { "_id" : { "$oid" : "4d068535e818f7cb98b63688"}} ,
 { "_id" : { "$oid" : "4d068545e818f7cba0b63688"}} ,
 { "_id" : { "$oid" : "4d068550e818f7cba6b63688"}}] ,
 "ok" : 1.0}

Adding the {"_id":1} limit to the query is a good practice if you want to retrieve the XML in a subsequent query. If this limit is omitted from the query, the full JSON representation will be returned for each result. If the records are large, this could significantly decrease performance.