Nosql RavdnDb自动索引
我有RavdnDb版本4.0中的此型号:Nosql RavdnDb自动索引,nosql,ravendb,ravendb-studio,Nosql,Ravendb,Ravendb Studio,我有RavdnDb版本4.0中的此型号: public class AppUser { public AppUser() { ActiveInApps = new Dictionary<string, ActiveApp>(); } public string Id { get; set; } public string PhoneNumber { get; set; } public Dictionary<str
public class AppUser
{
public AppUser()
{
ActiveInApps = new Dictionary<string, ActiveApp>();
}
public string Id { get; set; }
public string PhoneNumber { get; set; }
public Dictionary<string, ActiveApp> ActiveInApps { get; set; }
}
public class ActiveApp
{
public bool IsActive { get; set; } = true;
public string FirstName { get; set; }
public string LastName { get; set; }
[JsonIgnore]
public string DisplayName => $"{FirstName} {LastName}";
public DateTimeOffset LastActivity { get; set; }
}
并尝试使用此查询:
from AppUsers as user
where user.PhoneNumber > '92'
or user.ActiveInApps[].FirstName = 'test'
or user.ActiveInApps[].LastName = 'test'
or user.ActiveInApps[].UserName = 'test'
or user.ActiveInApps[].SerialNumber = 'test'
or user.ActiveInApps[].LastActivity = 'test'
RavenDb创建了一个自动索引
如何在RavenDb上查看生成的自动索引代码。 尝试此模式:
let p = u.ActiveInApps.Select(x=>x.Value).FirstOrDefault(aia => aia.IsActive == true)
您使用的是哪个版本的RavenDB?它在4.0和早期版本中有所不同。版本4.0!谢谢
let p = u.ActiveInApps.Select(x=>x.Value).FirstOrDefault(aia => aia.IsActive == true)