【发布时间】:2014-04-08 03:18:04
【问题描述】:
mongodb:
#Authors collection
db.authors.insert({name: 'Kobo', birthday: '1860', country: 'jp', tags: ['japan', 'avant-garde', 'screen', 'Akutagawa Prize']})
db.authors.insert({name: 'Sartr', birthday: '1905', country: 'fr', tags: [...]})
db.authors.insert({name: 'Braun', birthday: '1913', country: 'us', tags: [...]}
...
#Books collection
db.books.insert({title: 'book1', author: 'Kobo', year :''});
db.books.insert({title: 'book2', author: 'Sartr', year :''});
db.books.insert({title: 'book3', author: 'author', year :''});
...
Autor 标签会定期添加到 Authors 集合中。 本题不考虑使用图书标签。
需要找到作者有特定标签的所有书籍。比如“前卫”。 最有效的方法是什么? 在pymongo中怎么做?
【问题讨论】:
标签: mongodb