示例#1
0
  @Test
  public void getCollection() {
    DBCollection collection = template.getCollection(false);
    assertEquals("simple", collection.getName());
    assertEquals(ReadPreference.PRIMARY, collection.getReadPreference());

    collection = template.getCollection(true);
    assertEquals(ReadPreference.SECONDARY, collection.getReadPreference());

    collection = template.getCollection();
    assertEquals(mds.getDb().getReadPreference(), collection.getReadPreference());
  }
 @Override
 public MorphiaIterator<U, U> aggregate(final Class<U> target, final AggregationOptions options) {
   return aggregate(target, options, collection.getReadPreference());
 }
 SidistranDBCursor(DBCollection collection, Cursor cursor) {
   super(collection, null, null, collection.getReadPreference());
   this.__cursor = cursor;
 }
 @Override
 public MorphiaIterator<U, U> aggregate(final Class<U> target) {
   return aggregate(target, AggregationOptions.builder().build(), collection.getReadPreference());
 }