

@discover.register(Collection)
def discover_pymongo_collection(coll, n=50):
    items = list(take(n, coll.find()))
    if (not items):
        return (var * Record([]))
    oid_cols = [k for (k, v) in items[0].items() if isinstance(v, ObjectId)]
    for item in items:
        for col in oid_cols:
            del item[col]
    ds = discover(items)
    if isdimension(ds[0]):
        return (coll.count() * ds.subshape[0])
    else:
        raise ValueError('Consistent datashape not found')

dataset/ETHPy150Open blaze/odo/odo/backends/mongo.py discover_pymongo_collection/original