Saturday, 3 December 2011

Simple mongodb equivalents

After making a noob error today, I realised that some of the documentation could use a boost.

By default mongo returns the entire document.

All fields for the matched document will be returned

And in java

To return only certain fields, you need to let mongo know which ones you want

The will only return the fields meh and feh from the matched document

And in Java

You can also say 'all fields except for...'

This will return all the fields in the matched document expect for meh

And in Java

No comments:

Post a Comment