Helper method to actually perform the subdoc get count operation.
129
private Observable<DocumentFragment<Lookup>> getCountIn(final String id, final LookupSpec spec,
        final long timeout, final TimeUnit timeUnit) {
        return Observable.defer(new Func0<Observable<DocumentFragment<Lookup>>>() {
            @Override
            public Observable<DocumentFragment<Lookup>> call() {
                final SubGetCountRequest request = new SubGetCountRequest(id, spec.path(), bucketName);
                request.xattr(spec.xattr());
                request.accessDeleted(accessDeleted);
                addRequestSpan(environment, request, "subdoc_count");
                return applyTimeout(deferAndWatch(new Func1<Subscriber, Observable<SimpleSubdocResponse>>() {
                    @Override
                    public Observable<SimpleSubdocResponse> call(Subscriber s) {
                        request.subscriber(s);
                        return core.send(request);
                    }
                }).map(new Func1<SimpleSubdocResponse, DocumentFragment<Lookup>>() {
                    @Override
                    public DocumentFragment<Lookup> call(SimpleSubdocResponse response) {
                        try {
                            if (response.status().isSuccess()) {
                                try {
                                    long count = subdocumentTranscoder.decode(response.content(), Long.class);
                                    SubdocOperationResult<Lookup> single = SubdocOperationResult
                                        .createResult(spec.path(), Lookup.GET_COUNT, response.status(), count);
                                    return new DocumentFragment<Lookup>(id, response.cas(), response.mutationToken(),
                                        Collections.singletonList(single));
                                } finally {
                                    if (response.content() != null) {
                                        response.content().release();
                                    }
                                }
                            } else {
                                if (response.content() != null && response.content().refCnt() > 0) {
                                    response.content().release();
                                }

                                if (response.status() == ResponseStatus.SUBDOC_PATH_NOT_FOUND) {
                                    SubdocOperationResult<Lookup> single = SubdocOperationResult
                                        .createResult(spec.path(), Lookup.GET_COUNT, response.status(), null);
                                    return new DocumentFragment<Lookup>(id, response.cas(), response.mutationToken(), Collections.singletonList(single));
                                } else {
                                    throw SubdocHelper.commonSubdocErrors(response.status(), id, spec.path());
                                }
                            }
                        } finally {
                            if (environment.operationTracingEnabled()) {
                                environment.tracer().scopeManager()
                                    .activate(response.request().span(), true)
                                    .close();
                            }
                        }
                    }
                }), request, environment, timeout, timeUnit);
            }
        });
    }
448051
function() {
            let resultLangCount =  query('select count(*) as count from target_language');
            let resultResLvl3Count = query('select count(*) as count from resource where checking_level >= 3');
            let resultResCount = query('select count(*) as count from resource');
            let resultProjCount = query('select count(*) as count from (select id from project group by slug)');
            return {
                resource_count_level3:resultResLvl3Count[0]['count'],
                resource_count:resultResCount[0]['count'],
                target_language_count:resultLangCount[0]['count'],
                project_count:resultProjCount[0]['count']
            };
        }
139939
def get(self, doc_id):
        """"""
        resp_dict = self._get_query(q='id:{}'.format(doc_id))
        if resp_dict['response']['numFound'] > 0:
            return resp_dict['response']['docs'][0]
1246602
def count(cls, *criteria, **filters):
        """"""
        return cls.query.filter(*criteria).filter_by(**filters).count()
902522
function (next) {
            self.count().exec(function (err, count) {
                if (err) {
                    return next(err)
                }

                docsToIndex = count

                return next()
            })
        }
318933
public int getNumberOfDocs(String field) {
    if (fieldReferences.containsKey(field)) {
      FieldReferences fr = fieldReferences.get(field);
      return fr.numberOfDocs;
    } else {
      return 0;
    }
  }
1005034
def count(self):
        """"""
        if self._primary_keys is None:
            return self.queryset.count()
        else:
            return len(self.pks)
1188791
function count(req, res,next) {
  db.tags.count(function(err, count) {
    if(err) { return next(err); }
    res.json({count: count});
  });
}
536182
def _getValueCounts(mapping):
    
    return Counter({k: len(v) for k, v in viewitems(mapping)})
200763
def count(self, objectType, *args, **coolArgs) :
		""""""
		return self._makeLoadQuery(objectType, *args, **coolArgs).count()
13410
def count(self, view, include=None):
        
        return self._get(self._build_url(self.endpoint.count(id=view, include=include)))
1288008
def count(self, filter, **kwargs):
        
        return mongo_count(self._collection, filter=filter, **kwargs)
1023037
def _get_hit_count(self, database, enquire):
        
        return self._get_enquire_mset(
            database, enquire, 0, database.get_doccount()
        ).size()
110528
def _extract_counters(self):
        """"""
        # extract counters (if present)
        counters = ['nscanned', 'nscannedObjects', 'ntoreturn', 'nreturned',
                    'ninserted', 'nupdated', 'ndeleted', 'r', 'w', 'numYields',
                    'planSummary', 'writeConflicts', 'keyUpdates']

        # TODO: refactor mtools to use current counter names throughout
        # Transitionary hack: mapping of current names into prior equivalents
        counter_equiv = {
            'docsExamined': 'nscannedObjects',
            'keysExamined': 'nscanned',
            'nDeleted': 'ndeleted',
            'nInserted': 'ninserted',
            'nMatched': 'nreturned',
            'nModified': 'nupdated'
        }
        counters.extend(counter_equiv.keys())

        split_tokens = self.split_tokens

        # trigger operation evaluation to get access to offset
        if self.operation:
            for t, token in enumerate(split_tokens[self.datetime_nextpos +
                                                   2:]):
                for counter in counters:
                    if token.startswith('%s:' % counter):
                        try:
                            # Remap counter to standard name, if applicable
                            counter = counter_equiv.get(counter, counter)
                            vars(self)['_' + counter] = int((token.split(':')
                                                             [-1]).replace(',',
                                                                           ''))
                        except ValueError:
                            # see if this is a pre-2.5.2 numYields with space
                            # in between (e.g. "numYields: 2")
                            # https://jira.mongodb.org/browse/SERVER-10101
                            if (counter == 'numYields' and
                                    token.startswith('numYields')):
                                try:
                                    self._numYields = int((split_tokens[t + 1 + self.datetime_nextpos + 2]).replace(',', ''))
                                except ValueError:
                                    pass
                            if (counter == 'planSummary' and
                                    token.startswith('planSummary')):
                                try:
                                    self._planSummary = split_tokens[t + 1 + self.datetime_nextpos + 2]
                                    if self._planSummary:
                                        if split_tokens[t + 1 + self.datetime_nextpos + 3] != '{':
                                            self._actualPlanSummary = self._planSummary
                                        else:
                                            self._actualPlanSummary = '%s %s' % (
                                                self._planSummary,
                                                self._find_pattern('planSummary: %s' % self._planSummary, actual=True)
                                            )
                                except ValueError:
                                    pass

                        # token not parsable, skip
                        break
719371
def count(self):
        """"""
        cursor = self.conn.cursor()
        with contextlib.closing(cursor):
            cursor.execute('SELECT COUNT(*) FROM events')
            res = cursor.fetchone()
            return res[0]
474590
def _fetch(self, count=False):
        if self._result_cache is not None:
            return len(self._result_cache) if count else self._result_cache
        
        options = dict(self._options)  # make a local copy
        if self._where:
            # JSON encode WHERE values
            options['where'] = json.dumps(self._where)
        if self._select_related:
            options['include'] = ','.join(self._select_related)
        if count:
            return self._manager._count(**options)

        self._result_cache = self._manager._fetch(**options)
        return self._result_cache
177484
def _get_num_of_documents(self):
        '''
        
        '''
        parser = etree.XMLParser(target=XMLElementCountTarget('document'))
        # When iterated over, 'results' will contain the output from
        # target parser's close() method
        num_of_documents = etree.parse(self.urml_file, parser)
        self._num_of_documents = num_of_documents
        return num_of_documents