You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when using the Couchbase.Linq library, it is not possible to dynamically specify a collection name while executing LINQ queries. This is a feature commonly available in MongoDB’s .NET driver through methods like IMongoDatabase.GetCollection(), which allows developers to dynamically pass the collection name and immediately execute LINQ queries using AsQueryable().
For example, in MongoDB, one can write:
var collection = database.GetCollection<User>(User.GetCollectionName(appCode)).AsQueryable();
var users = collection.Where(u => u.Role == "admin").ToList();
This flexibility is extremely useful in multi-tenant applications where collection names are determined at runtime based on the tenant or application context.
In Couchbase, achieving similar functionality requires using N1QL queries and dynamic string interpolation, which lacks the type safety and readability of LINQ queries.
Feature Request:
Add support for dynamically specifying collection names within LINQ queries in the Couchbase.Linq library. For instance, it would be beneficial to have an API like:
var context = new BucketContext(bucket);
var collection = context.GetCollection<User>("dynamicCollectionName").AsQueryable();
var users = collection.Where(u => u.Role == "admin").ToList();
This feature would greatly enhance developer productivity, improve type safety, and align Couchbase LINQ capabilities with other database drivers that support dynamic collection names.
Thank you for considering this request!
The text was updated successfully, but these errors were encountered:
Hello,
Currently, when using the Couchbase.Linq library, it is not possible to dynamically specify a collection name while executing LINQ queries. This is a feature commonly available in MongoDB’s .NET driver through methods like IMongoDatabase.GetCollection(), which allows developers to dynamically pass the collection name and immediately execute LINQ queries using AsQueryable().
For example, in MongoDB, one can write:
This flexibility is extremely useful in multi-tenant applications where collection names are determined at runtime based on the tenant or application context.
In Couchbase, achieving similar functionality requires using N1QL queries and dynamic string interpolation, which lacks the type safety and readability of LINQ queries.
Feature Request:
Add support for dynamically specifying collection names within LINQ queries in the Couchbase.Linq library. For instance, it would be beneficial to have an API like:
This feature would greatly enhance developer productivity, improve type safety, and align Couchbase LINQ capabilities with other database drivers that support dynamic collection names.
Thank you for considering this request!
The text was updated successfully, but these errors were encountered: