Skip to content

Mongo.FindAndModifyResult.value can be nil but it is not specified so #278

Closed
@eseres

Description

@eseres

Driver version: 1.5.4

Dialyzer reports a warning because the field value inside type definition Mongo.FindAndModifyResult can actually take the value of nil but its type spec is BSON.document() for which nil is not a documented value.

lib/mongo/results.ex:

 @moduledoc """ The successful result struct of `Mongo.find_one_and_*` functions, which under the hood use Mongo's `findAndModify` API. See <https://docs.mongodb.com/manual/reference/command/findAndModify/> for more information. """ @type t :: %__MODULE__{ value: BSON.document(), matched_count: non_neg_integer(), upserted_id: String.t(), updated_existing: boolean() } defstruct [ :value, :matched_count, :upserted_id, :updated_existing ] end 

lib/bson.ex:

@type document :: %{atom => BSON.t()} | %{String.t() => BSON.t()} | [{atom, BSON.t()}] | [{String.t(), BSON.t()}] 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions