CouchDB通过JavaScript循环唯一的`_id`和Console.log

时间:2021-09-21 16:56:37

I Have 3 Records
"_id": "20","_id": "30" and "_id": "40".

我有3个记录“_id”:“20”,“_ id”:“30”和“_id”:“40”。

How Can I Console.log _id?

我怎么能控制台.log _id?

I want to Get This Output

我想得到这个输出

    20
    30
    40

1 个解决方案

#1


2  

Found very easy solve of problem :

发现很容易解决问题:

function(doc) {
  if (doc.user && doc.title) { // This check is important
    emit(doc.user, {id: doc._id});
  }
}

Then query it :

然后查询它:

GET /yourdb/_design/app/_view/by_user?key=film42

#1


2  

Found very easy solve of problem :

发现很容易解决问题:

function(doc) {
  if (doc.user && doc.title) { // This check is important
    emit(doc.user, {id: doc._id});
  }
}

Then query it :

然后查询它:

GET /yourdb/_design/app/_view/by_user?key=film42