1 | ;
|
2 |
|
3 | const get = require('../get');
|
4 |
|
5 | module.exports = function isDefaultIdIndex(index) {
|
6 | if (Array.isArray(index)) {
|
7 | // Mongoose syntax
|
8 | const keys = Object.keys(index[0]);
|
9 | return keys.length === 1 && keys[0] === '_id' && index[0]._id !== 'hashed';
|
10 | }
|
11 |
|
12 | if (typeof index !== 'object') {
|
13 | return false;
|
14 | }
|
15 |
|
16 | const key = get(index, 'key', {});
|
17 | return Object.keys(key).length === 1 && key.hasOwnProperty('_id');
|
18 | }; |
\ | No newline at end of file |