Skip to content

Commit

Permalink
Update JSON store to use update
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamd committed Feb 6, 2019
1 parent 7954845 commit f07b9d6
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion maggma/stores.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def connect(self, force_reset=False):
data = data.decode() if isinstance(data, bytes) else data
objects = json.loads(data)
objects = [objects] if not isinstance(objects, list) else objects
self.collection.insert_many(objects)
self.update(objects)

def __hash__(self):
return hash((*self.paths, self.lu_field))
Expand Down
2 changes: 1 addition & 1 deletion test_files/test_set/a.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"A": 0}, {"A": 1}, {"A": 2}, {"A": 3}, {"A": 4}, {"A": 5}, {"A": 6}, {"A": 7}, {"A": 8}, {"A": 9}]
[{"A": 0, "task_id": 0}, {"A": 1, "task_id": 1}, {"A": 2, "task_id": 2}, {"A": 3, "task_id": 3}, {"A": 4, "task_id": 4}, {"A": 5, "task_id": 5}, {"A": 6, "task_id": 6}, {"A": 7, "task_id": 7}, {"A": 8, "task_id": 8}, {"A": 9, "task_id": 9}]
2 changes: 1 addition & 1 deletion test_files/test_set/b.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"B": 10}, {"B": 11}, {"B": 12}, {"B": 13}, {"B": 14}, {"B": 15}, {"B": 16}, {"B": 17}, {"B": 18}, {"B": 19}]
[{"B": 10, "task_id": 10}, {"B": 11, "task_id": 11}, {"B": 12, "task_id": 12}, {"B": 13, "task_id": 13}, {"B": 14, "task_id": 14}, {"B": 15, "task_id": 15}, {"B": 16, "task_id": 16}, {"B": 17, "task_id": 17}, {"B": 18, "task_id": 18}, {"B": 19, "task_id": 19}]
Binary file modified test_files/test_set/c.json.gz
Binary file not shown.

0 comments on commit f07b9d6

Please sign in to comment.