From 6d22037602699c3cc2ca054688cd6938608426c4 Mon Sep 17 00:00:00 2001 From: Barak Michener Date: Sun, 10 Aug 2014 19:41:22 -0400 Subject: [PATCH] add iterator check for mongo --- graph/mongo/iterator.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/graph/mongo/iterator.go b/graph/mongo/iterator.go index 9e37089..8485ca9 100644 --- a/graph/mongo/iterator.go +++ b/graph/mongo/iterator.go @@ -140,10 +140,9 @@ func (it *Iterator) Clone() graph.Iterator { func (it *Iterator) Next() bool { var result struct { - Id string "_id" - //Sub string "Sub" - //Pred string "Pred" - //Obj string "Obj" + Id string "_id" + Added []int64 + Deleted []int64 } found := it.iter.Next(&result) if !found { @@ -153,6 +152,9 @@ func (it *Iterator) Next() bool { } return false } + if it.collection == "quads" && len(result.Added) <= len(result.Deleted) { + return it.Next() + } it.result = result.Id return true }