Skip to content

MemoryStore __eq__ does not behave as expected #788

Description

@sivonxay

When two memory stores are instantiated with the same collection_name, they are isolated and do not interact with each other. When a document is inserted into one MemoryStore, it is not visible from the other MemoryStore. Therefore, one would expect that these stores are not equivalent and the MemoryStore.__eq__() should return False, but this is not the case. Is this intended behavior?

As an example:

from maggma.stores import MemoryStore

store1 = MemoryStore()
store2 = MemoryStore()

store1.connect()
store2.connect()

store1 == store2  # Returns True

store1.update([{"a": 1, "b": 2}, {"a": 2, "b": 3}], 'a')
store1.query_one() # Returns {"_id": <Object Id>, "a": 1, "b": 2}
store2.query_one()  # Returns nothing

Activity

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions