Comments (8)
Hi,
Thanks for using this plugin.
Can you activate the debug on the plugin and send me the trace please.
Regards
from mongoose-datatable.
Thanks for your swift reply, I have attached my POST request data as well:
Here is the debug:
Query: { draw: 24,
columns:
[ { data: 'country.code',
name: '',
searchable: true,
orderable: true,
search: [Object],
regex: false },
{ data: 'name',
name: '',
searchable: true,
orderable: true,
search: [Object] },
{ data: 'vesseltype',
name: '',
searchable: true,
orderable: true,
search: [Object],
regex: false },
{ data: 'imo',
name: '',
searchable: true,
orderable: true,
search: [Object],
regex: false },
{ data: 'callSign',
name: '',
searchable: true,
orderable: true,
search: [Object],
regex: false },
{ data: 'MMSI',
name: '',
searchable: true,
orderable: true,
search: [Object],
regex: false },
{ data: 'length',
name: '',
searchable: true,
orderable: true,
search: [Object],
regex: false },
{ data: 'year',
name: '',
searchable: true,
orderable: true,
search: [Object],
regex: false },
{ data: 'timestamp',
name: '',
searchable: true,
orderable: true,
search: [Object],
regex: false },
{ data: 'country.name',
name: '',
searchable: true,
orderable: true,
search: [Object],
regex: false },
{ data: 'sat_phone1',
name: '',
searchable: true,
orderable: true,
search: [Object],
regex: false },
{ data: 'active',
name: '',
searchable: true,
orderable: true,
search: [Object] } ],
order: [ { column: 0, dir: 'asc' } ],
start: 0,
length: 10,
search: { value: '', regex: false } }
Search Criteria builded: { options: {},
pageStart: 0,
pageSize: 10,
nbColumns: 12,
search: undefined,
fields:
[ { index: 0,
model: 'vessels',
path: 'country.code',
searchable: true,
search: undefined,
sortable: true,
sort: { dir: 'asc', precedence: 0 },
selectable: true,
type: 'String',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 1,
model: 'vessels',
path: 'name',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'String',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 2,
model: 'vessels',
path: 'vesseltype',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'String',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 3,
model: 'vessels',
path: 'imo',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'Number',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 4,
model: 'vessels',
path: 'callSign',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'String',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 5,
model: 'vessels',
path: 'MMSI',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'String',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 6,
model: 'vessels',
path: 'length',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'Number',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 7,
model: 'vessels',
path: 'year',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'Number',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 8,
model: 'vessels',
path: 'timestamp',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'Date',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 9,
model: 'vessels',
path: 'country.name',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'String',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 10,
model: 'vessels',
path: 'sat_phone1',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'String',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 11,
model: 'vessels',
path: 'active',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'Boolean',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined } ],
select:
{ 'country.code': 1,
name: 1,
vesseltype: 1,
imo: 1,
callSign: 1,
MMSI: 1,
length: 1,
year: 1,
timestamp: 1,
'country.name': 1,
sat_phone1: 1,
active: 1 },
sort: { 'country.code': 'asc' },
conditions: undefined,
populate: [] }
Data: { draw: 24,
recordsTotal: 14697,
recordsFiltered: 14697,
data:
[ { _id: 55ee85d7d3fa876b47c02517,
name: 'Optimus',
vesseltype: '',
country: { name: '', code: null },
year: null,
length: null,
MMSI: null,
sat_phone1: '',
callSign: '',
active: true,
timestamp: Tue Jul 28 2015 20:41:26 GMT+0400 (GST),
imo: 9208095 },
{ _id: 55ee85d7d3fa876b47c02561,
name: 'Prabhu Shakti',
vesseltype: '',
country: { name: '', code: null },
year: null,
length: null,
MMSI: '563018710',
sat_phone1: '',
callSign: '9V9451',
active: true,
timestamp: Fri Jul 31 2015 14:13:42 GMT+0400 (GST),
imo: 9398981 },
{ _id: 55ee85d7d3fa876b47c02583,
name: 'Bourbon Explorer 512',
vesseltype: '',
country: { name: '', code: null },
year: null,
length: null,
MMSI: null,
sat_phone1: '',
callSign: '',
active: true,
timestamp: Sun Aug 02 2015 14:25:17 GMT+0400 (GST),
imo: 9654270 },
{ _id: 55ee85d7d3fa876b47c0251b,
name: 'Norderau',
vesseltype: '',
country: { name: '', code: null },
year: null,
length: null,
MMSI: null,
sat_phone1: '',
callSign: '',
active: true,
timestamp: Tue Jul 28 2015 23:46:20 GMT+0400 (GST),
imo: 9313670 },
{ _id: 55ee85d7d3fa876b47c027c4,
name: 'Marbella',
vesseltype: '',
country: { name: '', code: null },
year: null,
length: null,
MMSI: null,
sat_phone1: '',
callSign: '',
active: true,
timestamp: Wed Sep 02 2015 18:12:34 GMT+0400 (GST),
imo: 9189782 },
{ _id: 55ee85d7d3fa876b47c025d3,
name: 'Katerina III',
vesseltype: '',
country: { name: '', code: null },
year: null,
length: null,
MMSI: null,
sat_phone1: '',
callSign: '',
active: true,
timestamp: Wed Aug 05 2015 17:16:50 GMT+0400 (GST),
imo: 9500273 },
{ _id: 55ee85d7d3fa876b47c025c3,
name: 'AS ELENIA',
vesseltype: '',
country: { name: '', code: null },
year: null,
length: null,
MMSI: null,
sat_phone1: '',
callSign: '',
active: true,
timestamp: Tue Aug 04 2015 19:44:36 GMT+0400 (GST),
imo: 9485899 },
{ _id: 55ee85d7d3fa876b47c02568,
name: 'George K',
vesseltype: '',
country: { name: '', code: null },
year: null,
length: null,
MMSI: null,
sat_phone1: '',
callSign: '',
active: true,
timestamp: Fri Jul 31 2015 19:17:33 GMT+0400 (GST),
imo: 5842719 },
{ _id: 55ee85d7d3fa876b47c027c5,
name: 'Brattingsborg',
vesseltype: '',
country: { name: '', code: null },
year: null,
length: null,
MMSI: null,
sat_phone1: '',
callSign: '',
active: true,
timestamp: Wed Sep 02 2015 20:49:41 GMT+0400 (GST),
imo: 9488035 },
{ _id: 55ee85d7d3fa876b47c026e3,
name: 'Maersk Arkansas',
vesseltype: '',
country: { name: '', code: null },
year: 1998,
length: 155,
MMSI: '477 694100',
sat_phone1: '',
callSign: 'VRNJ8',
active: true,
timestamp: Tue Aug 18 2015 22:43:32 GMT+0400 (GST),
imo: 9164251 } ] }
from mongoose-datatable.
I have updated the module to version 1.0.6, the test (npm test) is uptodate with by field filter with regex.
I hope this will resolve your issue
from mongoose-datatable.
Thanks for quick action - Still having issues my regexp ends up looking this in the conditions "//tes/i/". but atleast select, sort, conditions are now shown in the debug.
Here's the debug info:
Query: { draw: 21,
columns:
[ { data: 'country.code',
name: '',
searchable: true,
orderable: true,
search: [Object] },
{ data: 'name',
name: '',
searchable: true,
orderable: true,
search: [Object] },
{ data: 'vesseltype',
name: '',
searchable: true,
orderable: true,
search: [Object] },
{ data: 'imo',
name: '',
searchable: true,
orderable: true,
search: [Object] },
{ data: 'callSign',
name: '',
searchable: true,
orderable: true,
search: [Object] },
{ data: 'MMSI',
name: '',
searchable: true,
orderable: true,
search: [Object] },
{ data: 'length',
name: '',
searchable: true,
orderable: true,
search: [Object] },
{ data: 'year',
name: '',
searchable: true,
orderable: true,
search: [Object] },
{ data: 'timestamp',
name: '',
searchable: true,
orderable: true,
search: [Object] },
{ data: 'country.name',
name: '',
searchable: true,
orderable: true,
search: [Object] },
{ data: 'sat_phone1',
name: '',
searchable: true,
orderable: true,
search: [Object] },
{ data: 'active',
name: '',
searchable: true,
orderable: true,
search: [Object] } ],
order: [ { column: 1, dir: 'asc' } ],
start: 0,
length: 10,
search: { value: '', regex: false } }
Search Criteria builded: { options: {},
pageStart: 0,
pageSize: 10,
nbColumns: 12,
search: undefined,
fields:
[ { index: 0,
model: 'vessels',
path: 'country.code',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'String',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 1,
model: 'vessels',
path: 'name',
searchable: true,
search: { chunks: [], search: //tes/i/ },
sortable: true,
sort: { dir: 'asc', precedence: 0 },
selectable: true,
type: 'String',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 2,
model: 'vessels',
path: 'vesseltype',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'String',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 3,
model: 'vessels',
path: 'imo',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'Number',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 4,
model: 'vessels',
path: 'callSign',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'String',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 5,
model: 'vessels',
path: 'MMSI',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'String',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 6,
model: 'vessels',
path: 'length',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'Number',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 7,
model: 'vessels',
path: 'year',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'Number',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 8,
model: 'vessels',
path: 'timestamp',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'Date',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 9,
model: 'vessels',
path: 'country.name',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'String',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 10,
model: 'vessels',
path: 'sat_phone1',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'String',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined },
{ index: 11,
model: 'vessels',
path: 'active',
searchable: true,
search: undefined,
sortable: true,
sort: undefined,
selectable: true,
type: 'Boolean',
ref: undefined,
refType: undefined,
arrayType: undefined,
base: undefined,
arrayPath: undefined } ],
select:
{ 'country.code': 1,
name: 1,
vesseltype: 1,
imo: 1,
callSign: 1,
MMSI: 1,
length: 1,
year: 1,
timestamp: 1,
'country.name': 1,
sat_phone1: 1,
active: 1 },
sort: { name: 'asc' },
conditions: { '$and': [ { name: { '$in': [ //tes/i/ ] } } ] },
populate: [] }
Data: { draw: 21, recordsTotal: 14697, recordsFiltered: 0, data: [] }
from mongoose-datatable.
What are you searching, I mean what string do you send to the server ?
If you send regex at true and send "tes", thi will be transformed into /tes/i regex.
In your trace, the search is //test/i, it should be /tes/i ?
from mongoose-datatable.
I want to send a regexp object to the server. I got it working fine with just sending a straight string like "tes". That has been working fine all along. But it would be awesome to be able to send a regexp object directly to the server to do more advanced queries.
So I'm still sending the same as previous, which is
/tes/i
or equal to (new RegExp("tes","i"))
and not in string format.
https://cloud.githubusercontent.com/assets/10369669/9988599/fc083fb2-6062-11e5-960e-c2e9a841d169.png
from mongoose-datatable.
There is not such thing as regexp object in json so you always send a string, if you send the boolean regex to true the module build the regex as new RegExp(STRING_SENT, 'i').
Here you are sending the string "/tes/i" and it will not go well because it will build the regex: "//tes/i/"
You should either send "tes" or you can redefine the conditionHandlers stringHandler in the module (cf. https://github.com/eherve/mongoose-datatable#condition-handlers)
I hope it helps.
from mongoose-datatable.
Ah yeah of course makes sense, thanks a lot for your help!
from mongoose-datatable.
Related Issues (20)
- Nested object search HOT 1
- mongoose-datatable-demo does not work with v1.0.4 HOT 2
- Nested object array search (Question) HOT 2
- Default Boolean handler not works for false value HOT 1
- Mongoose Queries HOT 10
- How to set conditions? HOT 1
- performance? HOT 1
- Unmanaged condition on field type: ObjectId HOT 3
- Can't get array data HOT 1
- Not working with __ttl document expiration via mongoose-ttl plugin HOT 2
- Date filtering HOT 5
- No data returned on mongoose 5 with options.conditions HOT 1
- search not working with populate data. HOT 1
- how to sort or order by date ('desc') HOT 1
- MongoDB uses non-optimal query indexes because of sort HOT 6
- Use aggregate with datatable HOT 1
- npm Installs Version 1.0.7 HOT 1
- Query lookup another collection, if not found still return HOT 1
- how to do subquery in formatter
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongoose-datatable.