Package org.bson

Examples of org.bson.BSONObject.containsField()


        BSONObject q = (BSONObject) query.get("query");
        TreeSet<Object> values = new TreeSet<Object>(new ValueComparator());

        for (Integer pos : queryDocuments(q)) {
            BSONObject document = documents.get(pos.intValue());
            if (document.containsField(key))
                values.add(document.get(key));
        }

        BSONObject response = new BasicBSONObject("values", new ArrayList<Object>(values));
        Utils.markOkay(response);
View Full Code Here


    public void map(final Object key, final BSONObject val, final Context context)
        throws IOException, InterruptedException {

        if (val.containsField("headers")) {
            BSONObject headers = (BSONObject) val.get("headers");
            if (headers.containsField("From") && headers.containsField("To")) {
                String from = (String) headers.get("From");
                String to = (String) headers.get("To");
                String[] recipients = to.split(",");
                for (final String recip1 : recipients) {
                    String recip = recip1.trim();
View Full Code Here

    public void map(final Object key, final BSONObject val, final Context context)
        throws IOException, InterruptedException {

        if (val.containsField("headers")) {
            BSONObject headers = (BSONObject) val.get("headers");
            if (headers.containsField("From") && headers.containsField("To")) {
                String from = (String) headers.get("From");
                String to = (String) headers.get("To");
                String[] recipients = to.split(",");
                for (final String recip1 : recipients) {
                    String recip = recip1.trim();
View Full Code Here

    @Override
    public void map(final Object key, final BSONWritable writable, final OutputCollector<MailPair, IntWritable> output,
                    final Reporter reporter) throws IOException {
        BSONObject value = writable.getDoc();
        if (value.containsField("headers")) {
            BSONObject headers = (BSONObject) value.get("headers");
            if (headers.containsField("From") && headers.containsField("To")) {
                String from = (String) headers.get("From");
                String to = (String) headers.get("To");
                String[] recipients = to.split(",");
View Full Code Here

    public void map(final Object key, final BSONWritable writable, final OutputCollector<MailPair, IntWritable> output,
                    final Reporter reporter) throws IOException {
        BSONObject value = writable.getDoc();
        if (value.containsField("headers")) {
            BSONObject headers = (BSONObject) value.get("headers");
            if (headers.containsField("From") && headers.containsField("To")) {
                String from = (String) headers.get("From");
                String to = (String) headers.get("To");
                String[] recipients = to.split(",");
                for (final String recip1 : recipients) {
                    String recip = recip1.trim();
View Full Code Here

    public void map(final Object key, final BSONWritable writable, final OutputCollector<MailPair, IntWritable> output,
                    final Reporter reporter) throws IOException {
        BSONObject value = writable.getDoc();
        if (value.containsField("headers")) {
            BSONObject headers = (BSONObject) value.get("headers");
            if (headers.containsField("From") && headers.containsField("To")) {
                String from = (String) headers.get("From");
                String to = (String) headers.get("To");
                String[] recipients = to.split(",");
                for (final String recip1 : recipients) {
                    String recip = recip1.trim();
View Full Code Here

            BSONObject $set = (BSONObject) update.get("$addToSet");
            for (String k : $set.keySet()) {
              Object x = $set.get(k);
              if (x instanceof BSONObject) {
                BSONObject b = (BSONObject) x;
                if (b.containsField("$each")) {
                  for (Object each : BSONUtils.values(b,
                      "$each"))
                    BSONUtils.addToSet(t, k, each);
                  continue;
                }
View Full Code Here

        String lastName = null;
        if ( _nameStack.size() > 0 ){
            lastName = _nameStack.removeLast();
        }
        if ( ! ( o instanceof List ) && lastName != null &&
             o.containsField( "$ref" ) &&
             o.containsField( "$id" ) ){
            return cur().put(lastName, new DBRef( _db, o ) );
        }

        return o;
View Full Code Here

        if ( _nameStack.size() > 0 ){
            lastName = _nameStack.removeLast();
        }
        if ( ! ( o instanceof List ) && lastName != null &&
             o.containsField( "$ref" ) &&
             o.containsField( "$id" ) ){
            return cur().put(lastName, new DBRef( _db, o ) );
        }

        return o;
    }
View Full Code Here

            return o;
        }
        BSONObject b = (BSONObject) o;

        // override the object if it's a special type
        if (b.containsField("$oid")) {
            o = new ObjectId((String) b.get("$oid"));
        } else if (b.containsField("$date")) {
            if (b.get("$date") instanceof Number) {
                o = new Date(((Number) b.get("$date")).longValue());
            } else {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.