Click here to Skip to main content
15,502,919 members

Comments by VICK (Top 200 by date)

VICK 1-Mar-21 1:37am View    
seems like if we dont sort the records (default _id sort will work in that way), it works properly. But even If I add index on CreatedAt field and sort on that it still wont work. So for now going with the default index sort i.e. _id.

Thanks for your help.
VICK 26-Feb-21 9:57am View    
Tried without async and same. When trying with page size 50, few records are not coming up but if i get the collection in a single go with higer page number, then everything is fine.
VICK 26-Feb-21 9:45am View    
We are using ReplaceOneAsync inside the update method and in the get fetching records sorted based on CreatedDate.

=====================

var filter = Builders<document>
.Filter
.Eq(x => x.Id, passedDocument.Id);


filter &= Builders<document>
.Filter
.Eq(x => x._status, (int)StatusEnum.Active);


var result = await _Collection.ReplaceOneAsync(filter, passedDocument);

===================================

var documents = await _collection.AsQueryable()
.Where(i => i._status == (int)StatusEnum.Active)
.OrderBy(i => i.CreatedAt)
.Skip((page - 1) * size)
.Take(size)
.ToListAsync();

==============================

As we are sorting out based on CreatedDate, should not the sequence be same ?

One more thing to note is CreatedDate is DateTimeOffset type in .net code and db is mongo.
VICK 10-May-18 2:15am View    
Have you checked the browser console for any client end errors or debugged the application to find out whats happening actually?
VICK 3-Nov-16 8:54am View    
Actually I didn't get any method from the TimePeriodLibrary regarding TimeRange issue without comparison of the date parts. Or else I was unable to understand it in depth.
Would be pretty happy If you could make a code snippet using that Library as per my above mentioned scenario?