Skip to content

encode gives wrong results for objects embedded in vectors #2

@shlomi-nx

Description

@shlomi-nx
> encode({f:[{a:{b:2}}]})
   {“f”:[{“a.b”:2}]})

However, sticking that in mongo's update does not give the desired results:

> db.test.update({..}, {$set : {“f”:[{“a.b”:2}]}})
{ “_id” : ObjectId("…"), ... , “f” : [ { “a.b” : 2 } ] }

Essentially, the dot-notation is only relevant in top-level entries. Anything below, mongo treats as the key name directly.

I would think that the correct behavior of encode should be to not recursively apply dot notations into vectors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions