HI Jens,
Sorry for the confusion.
If you check my second post you will notice the code which I use I will
paste it here again.
var view = _database.CreateAllDocumentsQuery();
var docs = view.Run().Select(x => new DatabaseUtils.
CacheData
{
DescrName = (string) x.Document.Properties["name"],
Date = Convert.ToInt32(x.Document.Properties["date"]),
DescriptionType = Convert.ToInt32(x.Document.Properties[
"type"]),
Version = (string) x.Document.Properties["version"]
});
_iterator = docs.GetEnumerator();
so I actually use _database.CreateAllDocumentsQuery();
but the name of variable I choose is wrong. I kept it as "view" which
probably cause the confusion.
And the view creation code which I posted earlier
view.SetMapReduce((
IDictionary<string, object> document, EmitDelegate emitter) => {
if (document["_id"] != null) {
emitter(document["_id"], document["_id"]);
}
this one is old code and I don use it.
But the point is that even though I use _database.CreateAllDocumentsQuery();
its dead slow.
Just to give more info the database which I am querying has about 10000
documents and some of the document size is more than 90MB. Is that the
reason of it being slow?
But what I wanted is just few properties of the document but not full
document.
Once again sorry for the confusion.
On Tuesday, 2 September 2014 21:38:17 UTC+5:30, Jens Alfke wrote:
>
>
> On Sep 1, 2014, at 7:21 PM, [email protected] <javascript:> wrote:
>
> view.SetMapReduce((IDictionary<string, object> document,
> EmitDelegate emitter) => {
> if (document["_id"] != null) {
> emitter(document["_id"], document["_id"]);
>
> }
>
>
> There's no reason to create a view like this — it's identical to the
> built-in all-documents view. Just call Database.createAllDocsQuery instead,
> if you want to iterate over all documents.
>
> (Also, as s.anderson pointed out, document["_id"] is never null, and it's
> redundant to emit it as the value since it's already the key.)
>
> —Jens
>
--
You received this message because you are subscribed to the Google Groups
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/mobile-couchbase/f69382dc-e8d4-471f-948e-820b564fb82b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.