Skip to content

bad sort specification in ../vendor/mongodb/mongodb/src/Operation/Find.php #1739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ludo1960 opened this issue Apr 1, 2019 · 5 comments
Open

Comments

@ludo1960
Copy link

ludo1960 commented Apr 1, 2019

I am struggling to resolve an issue, trying to install laravel-admin, all seem well with the install, but when I try to browse the site I get the following error
/var/www/slimmongo.local.com/vendor/mongodb/mongodb/src/Operation/Find.php
/**
* Execute the operation.
*
* @see Executable::execute()
* @param Server $server
* @return Cursor
* @throws UnsupportedException if collation or read concern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
if (isset($this->options['collation']) && ! \MongoDB\server_supports_feature($server, self::$wireVersionForCollation)) {
throw UnsupportedException::collationNotSupported();
}

    if (isset($this->options['readConcern']) && ! \MongoDB\server_supports_feature($server, self::$wireVersionForReadConcern)) {
        throw UnsupportedException::readConcernNotSupported();
    }

    $cursor = $server->executeQuery($this->databaseName . '.' . $this->collectionName, new Query($this->filter, $this->createQueryOptions()), $this->createExecuteOptions());

    if (isset($this->options['typeMap'])) {
        $cursor->setTypeMap($this->options['typeMap']);
    }

    return $cursor;
}

public function getCommandDocument(Server $server)
{
    return $this->createCommandDocument();
}

/**
 * Construct a command document for Find
 */
private function createCommandDocument()
{
    $cmd = ['find' => $this->collectionName, 'filter' => (object) $this->filter];

Arguments
"bad sort specification (View: /var/www/slimmongo.local.com/vendor/encore/laravel-admin/resources/views/partials/sidebar.blade.php) (View: /var/www/slimmongo.local.com/vendor/encore/laravel-admin/resources/views/partials/sidebar.blade.php) (View: /var/www/slimmongo.local.com/vendor/encore/laravel-admin/resources/views/partials/sidebar.blade.php) `

The contents of the partial are:

`

<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">

    <!-- Sidebar user panel (optional) -->
    <div class="user-panel">
        <div class="pull-left image">
            <img src="{{ Admin::user()->avatar }}" class="img-circle" alt="User Image">
        </div>
        <div class="pull-left info">
            <p>{{ Admin::user()->name }}</p>
            <!-- Status -->
            <a href="#"><i class="fa fa-circle text-success"></i> {{ trans('admin.online') }}</a>
        </div>
    </div>
    <!-- Sidebar Menu -->
    <ul class="sidebar-menu">
        <li class="header">{{ trans('admin.menu') }}</li>

        @each('admin::partials.menu', Admin::menu(), 'item')

    </ul>
    <!-- /.sidebar-menu -->
</section>
<!-- /.sidebar -->
`

Can anybody suggest where to start digging?

@ludo1960
Copy link
Author

ludo1960 commented Apr 1, 2019

Mongo does not like @each('admin::partials.menu', Admin::menu(), 'item') Any solutions?

@vntrungld
Copy link

vntrungld commented Apr 10, 2019

This is laravel-admin bug, not laravel-mongodb bug

My solution:
Replace all content in function allNodes of Menu model by
return static::with('roles')->orderBy('order')->get()->toArray();

@ludo1960
Copy link
Author

Thank you Lam, got it working! 血淋淋的奇妙

There is an extra item in the menu "index" at the top, Admin will not let me delete it and when I try to edit the page I get " ModelNotFoundException In Builder.php line 369 :
No query results for model [Encore\Admin\Auth\Database\Menu] 1" Is it the same for you? Do I just ignore it?

谢谢

@ludo1960
Copy link
Author

Eeek!! trying to insert any data i.e. permissions, roles. users. Results in

"FatalThrowableError In ManagesTransactions.php line 109 :Call to a member function beginTransaction() on null"

@GromNaN
Copy link
Member

GromNaN commented Nov 15, 2023

Feature request tracked in Jira PHPORM-120

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants