Esempio n. 1
0
  private void writeQuery(final DBObject fields, final int numToSkip, final int batchSize) {
    writeInt(_queryOptions);
    writeCString(_collection.getFullName());

    writeInt(numToSkip);
    writeInt(batchSize);

    putObject(_query);
    if (fields != null) putObject(fields);
  }
Esempio n. 2
0
  private void writeUpdate(
      final boolean upsert, final boolean multi, final DBObject query, final DBObject o) {
    writeInt(0); // reserved
    writeCString(_collection.getFullName());

    int flags = 0;
    if (upsert) flags |= 1;
    if (multi) flags |= 2;
    writeInt(flags);

    putObject(query);
    putObject(o);
  }
Esempio n. 3
0
  private void writeRemove() {
    writeInt(0); // reserved
    writeCString(_collection.getFullName());

    Collection<String> keys = _query.keySet();

    if (keys.size() == 1
        && keys.iterator().next().equals("_id")
        && _query.get(keys.iterator().next()) instanceof ObjectId) writeInt(1);
    else writeInt(0);

    putObject(_query);
  }