markc
January 6, 2018, 3:24pm
1
My class defines Id as the key. I’ve created a GetAll() function using the following:
var query = from q in _context.Query()
select q;
return query;
_context is a BucketContext
The docs returned contain all the data but the id is always null. Can someone please explain to me why?
Thanks!
Hi @markc ,
I assume you’re referring to Linq2Couchbase here? I believe you’ll need to use N1QlFunctions.Meta. In Couchbase, the Id is not part of the document, but rather meta data about the document.
For more information, see the Linq2Couchbase docs on Meta
2 Likes
You may also use N1qlFunctions.Key(q) in the select projection as a shortcut directly to the key.
3 Likes
markc
January 6, 2018, 9:20pm
4
Thanks Matthew and btburnett!
2 Likes