Reputation: 17647
I am considering DocumentDB, specially for the ability to bring my MongoDB code to work with it. DocumentDB is very fast and affordable, but I am having some difficulty:
I have this code that works on MongoDB:
var categoriesList = await Pessoa.Distinct<string>("Enderecos.Cidade", new BsonDocument()).ToListAsync();
This Exception happens:
MongoCommandException: Command distinct failed: Command is not supported.
On this code:
var cidades = Pedido.AsQueryable().Where(d => d.DocType == new Pedido().DocType)
.GroupBy(p => p.Cliente.Enderecos[0].Cidade)
.ToList();
It gives this exception:
MongoDB.Driver.MongoCommandException: 'Command aggregate failed: '$group' is not supported.'
What can I do to make it work on DocumentDB? Is there any simple equivalent code I can do to have this feature? Distinct / Group by on DocumentDB?
DocumentDB must support this. I will probably stay on Mongo until they release these features.
Upvotes: 0
Views: 742
Reputation: 1658
Tony-
Support for GroupBy is coming. In the mean time, here are a few ways you can implement the same functionality:
Upvotes: 2