1

How can i filter a date field in document store table (NoSQL) in c#. i need to filter created ate greater than particular time.

the date is storing as string values in nosql.

I had only found the below mentioned code to filter in C# mysql-x-devspi.

var myDb = mySession.GetSchema(Myschema);
var myColl = myDb.CreateCollection("Mytbl",true);
var docs = myColl.Find("createdtime > :starttime")
.Bind("starttime", DateTime.UtcNow)
.Execute();
Mahesh
  • 33
  • 5
  • NOsqöl lioke MONDB and mysql which is rdms have not that much in common, so that you really can't make a nosql mysql search. Can you provide, your source? – nbk Sep 07 '20 at 22:13
  • @nbk See the official documentation: https://www.mysql.com/products/enterprise/document_store.html – Bradley Grainger Sep 07 '20 at 22:17
  • Mongodb goes much further than JSON and the support ss getting much better in the last version like JSON_TABLE, but still manipulation is a bad as the use comma delimited Columns. MYsql and c# is it is best to use Net connector, but nit the only way. – nbk Sep 07 '20 at 22:23

1 Answers1

2

You need a date value from somewhere and which you want to filter aso

MySQL needs "his" date format, automatic doesn't work always.

 DateTime dateValue= DateTime.Now;
 ....
.Bind("starttime", dateValue.ToString("yyyy-MM-dd HH:mm:ss")) 

But as stated in my comment a RDMS like MySQL and a NoSQL are mainly different, and mysql is definitely no NoSQL.

You can take a look https://www.sitepoint.com/sql-vs-nosql-differences/ where the main differences are explaind

nbk
  • 45,398
  • 8
  • 30
  • 47