Find an object by the given id

@param id The id
@return The object
@throws MongoException If an error occurred
487980
public T findOneById(K id, T fields) throws MongoException {
        return findOneById(id, convertToBasicDbObject(fields));
    }
690668
public E findById(ID id) {
        LOG.trace("Finding " + entityClass.getSimpleName() + " with ID " + id);
        return (E) getSession().get(entityClass, id);
    }
827680
def by_id(cls, oid):
        """"""
        if oid:
            d = cls.collection.find_one(ObjectId(oid))
            if d:
                return cls(**d)
765905
static public function createObjectID($id=null)
    {
        if ($id === null) {
            return new \MongoDB\BSON\ObjectId;
        }

        try {
            return new \MongoDB\BSON\ObjectId($id);
        } catch(\MongoDB\Driver\Exception\InvalidArgumentException $e) {
        }

        throw new Exception('Invalid ObjectId');
    }
521470
private function find($id): ?Model
    {
        try {
            return $this->repository->findOrFail($id);
        } catch (ModelNotFoundException $exception) {
            return null;
        }
    }
792327
def find(cls, _id):
        

        if not _id:
            return None
        try:
            return next(cls.where(id=_id))
        except StopIteration:
            raise PanoptesAPIException(
                "Could not find {} with id='{}'".format(cls.__name__, _id)
            )
1015361
public function get($id)
    {
        if (isset($this->objects[$id])) {
            return $this->objects[$id];
        } else {
            return false;
        }
    }
104691
public static function find($id)
	{
		$object = new static;
		$response = $object->request('GET', sprintf('%s/%s', $object->getUrl(), $id));

		return $response ? $object : false;
	}
326723
public function getObjectById($id)
    {
        if (isset($this->objects[$id])) {
            return $this->objects[$id];
        } else {
            return null;
        }
    }
1237798
public static function findById($id, $throwException = true)
    {
        $e = $throwException ? new ServerErrorHttpException("Property with id $id not found") : false;

        return static::loadModel(
            $id,
            false,
            true,
            86400,
            $e,
            true
        );
    }
1169671
public Object getObjectWithId( IdKey id ) {
        if ( null != idToObject ) {
            return idToObject.get( id );
        }
        return null;
    }
289023
public static function find($id)
    {
        $collection = json_decode(self::get("/collections/{$id}")->getBody(), true);

        return new self($collection);
    }
534322
@Override
  public <T> T findById(Object id, Class<T> entityClass) {
    return findById(id, Util.determineCollectionName(entityClass));
  }
681975
def find(id)
      begin
        if repository?
          super(id)
        else
          serialize!(PersistenceAdapter.find(self, id))
        end
      rescue Exception => e
        message = "Couldn't find #{self} with ID=#{id}"
        message = "Couldn't find all #{self} objects with IDs (#{id.join(', ')})" if id.is_a?(Array)

        raise ActiveHash::RecordNotFound.new(message)
      end
    end
525378
function (soajs, id) {
        let id1;
        try {
            id1 = soajs.mongoDb.ObjectId(id.toString());
            return id1;
        }
        catch (e) {
            soajs.log.error(e);
            throw e;
        }
    }
132492
@Override
  public Entity findOneById(Object id) {
    Entity entity = delegate().findOneById(id);
    return entity != null ? resolveEntityReferences(entity) : null;
  }
1010762
def get_by_id(cls, id):
        

        if any((isinstance(id, basestring) and id.isdigit(), isinstance(id,
               (int, float)))):
            return cls.query.get(int(id))
        return None