Skip to content

Fix attribute read for values nested on multiple levels #1069

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

Merged
merged 3 commits into from
Jan 27, 2017

Conversation

bstanescu
Copy link
Contributor

@bstanescu bstanescu commented Jan 3, 2017

There is a bug in the retrieval of intermediary nested values
Let's assume the following structure of data:
$foo['a.b.c'] = 1;

>>> $foo['a'];
=> [
     "b" => [
       "c" => 1,
     ],
   ]

>>> $foo['a.b'];
=> null // <-- this is wrong as it should return this:

>>> $foo['a']['b'];
=> [
     "c" => 1,
   ]

>>> $foo['a.b.c'];  // this works fine
=> 1

@jenssegers
Copy link
Contributor

Could you still use the if that checks if the key contains a dot? So that we still use the parent logic in any other case.

@bstanescu
Copy link
Contributor Author

Good point (pun intended 😄 ). Done.

@jenssegers jenssegers merged commit 05a7cf8 into mongodb:master Jan 27, 2017
mnphpexpert added a commit to mnphpexpert/laravel-mongodb that referenced this pull request Sep 2, 2024
* Add test for multiple level nested dot notation

* Fix multiple level attributes using dot notation

* Mantain parent logic on attribute read for non dot keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants