@@ -0,0 +1,2211 @@
+package org.jongo.spike;%0A%0Aimport com.mongodb.DBObject;%0Aimport com.mongodb.QueryBuilder;%0Aimport org.bson.types.ObjectId;%0Aimport org.jongo.MongoCollection;%0Aimport org.jongo.marshall.jackson.JacksonProcessor;%0Aimport org.jongo.model.People;%0Aimport org.jongo.util.JongoTestCase;%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport static org.fest.assertions.Assertions.assertThat;%0A%0Apublic class QuestionsSpikeTest extends JongoTestCase %7B%0A%0A    private MongoCollection collection;%0A%0A    @Before%0A    public void setUp() throws Exception %7B%0A        collection = createEmptyCollection(%22users%22);%0A    %7D%0A%0A    @After%0A    public void tearDown() throws Exception %7B%0A        dropCollection(%22users%22);%0A    %7D%0A%0A    @Test%0A    //http://stackoverflow.com/questions/10444038/mongo-db-query-in-java/10445169#10445169%0A    public void complexQueryWithDriverAndJongo() throws Exception %7B%0A%0A        List%3CString%3E keys = new ArrayList%3CString%3E();%0A        collection.findOne(%22%7B$or:%5B%7Bkey1: %7B$in:%5B764%5D%7D%7D,%7Bkey2:%7B$in:%5B#%5D%7D%7D, %7B$and:%5B%7Bkey3:3%7D,%7Bkey4:67%7D%5D%7D%5D%7D%22, keys).as(People.class);%0A%0A        DBObject query = QueryBuilder.start().or(%0A                QueryBuilder.start(%22key1%22).in(764).get(),%0A                QueryBuilder.start(%22key2%22).in(keys).get(),%0A                QueryBuilder.start().and(%22key3%22).is(3).and(%22key4%22).is(64).get()%0A        ).get();%0A%0A        getDB().getCollection(%22users%22).find(query);%0A    %7D%0A%0A    @Test%0A    //https://groups.google.com/forum/?hl=fr&fromgroups#!topic/jongo-user/ga3n5_ybYm4%0A    public void pushANonBSONObject() throws Exception %7B%0A        Peoples peoples = new Peoples();%0A        peoples.add(new People(%22john%22));%0A        peoples.add(new People(%22peter%22));%0A        collection.save(peoples);%0A%0A        String robert = new JacksonProcessor().marshall(new People(%22Robert%22));%0A        collection.update(%22%7B%7D%22, %22%7B$push:%7Bpeoples:%22 + robert + %22%7D%7D%22);%0A%0A        assertThat(collection.count(%22%7B peoples.name : 'Robert'%7D%22)).isEqualTo(1);%0A    %7D%0A%0A    private static class Peoples %7B%0A        private ObjectId _id;%0A        private List%3CPeople%3E peoples = new ArrayList%3CPeople%3E();%0A%0A        public void add(People buddy) %7B%0A            peoples.add(buddy);%0A        %7D%0A    %7D%0A%7D%0A

Add spike with mailing-list questions