I need to get some small data from every document that I have in the database, but I still want to reduce traffic in order to prevent "Scanning the table" (just a term, I know it is not a table).
I have a collection of let say "Books" (simply because everyone uses it to give examples), now my problem is that I want only the titles of books with this author.
var filter = Builders<Book>.Filter.Eq(n => n.Author, AuthorId); List<string> books = new List<string>(); using (var cursor = await BooksCollection.FindAsync(filter)) { while (await cursor.MoveNextAsync()) { var batch = cursor.Current; foreach (Book b in batch) books.Add(b.Title); } }
But when I look at the entire result of the collection, I use large chunks of data, right? suggests that these are not books, but entire network grids, and each document is about 5-10 MB, and I have thousands of them. Can I reduce traffic here without storing this data in another collection?
Edit I think it is called "Views" in the SQL database.
source share