jtushman/monarch — pull request #7 by jtushman (2014-11-19 19:44:59+00:00)
Title: adding first pass at query_sets

[Provisional]

Adds support for partial db copies

you can generate a partial like so:

`monarch generate_queryset awesome_dogs`

Then you can write your partial like so

```
from monarch import QuerySet
import pymongo

class AwesomeDogs(QuerySet):

def run(self):

# prompts
dog_type = click.prompt('Please enter a valid integer', type=int)
after_date_string = click.prompt('Please enter a date')

after = DateTime(after_date_string)

awesome_dogs = self.connection['dogs'].find({"type": dog_type,
'born_after': after})
awesome_dog_ids = [dog.id for dog in awesome_dogs]

self.dump_collection('dogs', {"_id": {"$in": awesome_dogs_ids}})
self.dump_collection('dog_houses', {"dog_id: {"$in": awesome_dogs_ids}})
```