示例#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);
  }
示例#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);
  }
示例#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);
  }