FeathersJS create compound index for collection
Is there any way with FeathersJS service to create a compound index for a MongoDB DB?
mongodb feathersjs compound-index
add a comment |
Is there any way with FeathersJS service to create a compound index for a MongoDB DB?
mongodb feathersjs compound-index
Are you usingfeathers-mongodb
orfeathers-mongoose
? They would have different ways of approaching it. AFAIK the plainfeathers-mongodb
simply allows you to return theCollection
object from the registered service. So you would just do that and then callcreateIndex()
just as you would with the regular node driver.
– Neil Lunn
Nov 13 '18 at 12:27
I'm using feathers-mongodb. Where should this "createIndex()" be done?
– Jordi Blanch
Nov 13 '18 at 12:36
So it should basically be something likeservice('service-name').Model.createIndex( ... )
with all the regularcreateIndex()
options for your compound index. The adapter is nothing special and theModel
property is simply aCollection
object as already mentioned.
– Neil Lunn
Nov 13 '18 at 12:39
Hello Neil, sorry for bothering you again, but in my last question I meant where in the FeathersJS file structure should this be done? I've tried in "servicename.service.js" file, after the service sets the Model field of service variable, but it seems not to be working for me. Do you know exactly where in the FeathersJS file structure should it be done? Thanks!
– Jordi Blanch
Nov 13 '18 at 15:13
Hello again... I was not defining correctly the compound index, now it is working, but I'm still wondering whether the place I've called the "createIndex()" is "FeathersJS compliant" or it should be done anywhere else not to break the FeathersJS intended flow...
– Jordi Blanch
Nov 13 '18 at 15:48
add a comment |
Is there any way with FeathersJS service to create a compound index for a MongoDB DB?
mongodb feathersjs compound-index
Is there any way with FeathersJS service to create a compound index for a MongoDB DB?
mongodb feathersjs compound-index
mongodb feathersjs compound-index
asked Nov 13 '18 at 12:20
Jordi BlanchJordi Blanch
326
326
Are you usingfeathers-mongodb
orfeathers-mongoose
? They would have different ways of approaching it. AFAIK the plainfeathers-mongodb
simply allows you to return theCollection
object from the registered service. So you would just do that and then callcreateIndex()
just as you would with the regular node driver.
– Neil Lunn
Nov 13 '18 at 12:27
I'm using feathers-mongodb. Where should this "createIndex()" be done?
– Jordi Blanch
Nov 13 '18 at 12:36
So it should basically be something likeservice('service-name').Model.createIndex( ... )
with all the regularcreateIndex()
options for your compound index. The adapter is nothing special and theModel
property is simply aCollection
object as already mentioned.
– Neil Lunn
Nov 13 '18 at 12:39
Hello Neil, sorry for bothering you again, but in my last question I meant where in the FeathersJS file structure should this be done? I've tried in "servicename.service.js" file, after the service sets the Model field of service variable, but it seems not to be working for me. Do you know exactly where in the FeathersJS file structure should it be done? Thanks!
– Jordi Blanch
Nov 13 '18 at 15:13
Hello again... I was not defining correctly the compound index, now it is working, but I'm still wondering whether the place I've called the "createIndex()" is "FeathersJS compliant" or it should be done anywhere else not to break the FeathersJS intended flow...
– Jordi Blanch
Nov 13 '18 at 15:48
add a comment |
Are you usingfeathers-mongodb
orfeathers-mongoose
? They would have different ways of approaching it. AFAIK the plainfeathers-mongodb
simply allows you to return theCollection
object from the registered service. So you would just do that and then callcreateIndex()
just as you would with the regular node driver.
– Neil Lunn
Nov 13 '18 at 12:27
I'm using feathers-mongodb. Where should this "createIndex()" be done?
– Jordi Blanch
Nov 13 '18 at 12:36
So it should basically be something likeservice('service-name').Model.createIndex( ... )
with all the regularcreateIndex()
options for your compound index. The adapter is nothing special and theModel
property is simply aCollection
object as already mentioned.
– Neil Lunn
Nov 13 '18 at 12:39
Hello Neil, sorry for bothering you again, but in my last question I meant where in the FeathersJS file structure should this be done? I've tried in "servicename.service.js" file, after the service sets the Model field of service variable, but it seems not to be working for me. Do you know exactly where in the FeathersJS file structure should it be done? Thanks!
– Jordi Blanch
Nov 13 '18 at 15:13
Hello again... I was not defining correctly the compound index, now it is working, but I'm still wondering whether the place I've called the "createIndex()" is "FeathersJS compliant" or it should be done anywhere else not to break the FeathersJS intended flow...
– Jordi Blanch
Nov 13 '18 at 15:48
Are you using
feathers-mongodb
or feathers-mongoose
? They would have different ways of approaching it. AFAIK the plain feathers-mongodb
simply allows you to return the Collection
object from the registered service. So you would just do that and then call createIndex()
just as you would with the regular node driver.– Neil Lunn
Nov 13 '18 at 12:27
Are you using
feathers-mongodb
or feathers-mongoose
? They would have different ways of approaching it. AFAIK the plain feathers-mongodb
simply allows you to return the Collection
object from the registered service. So you would just do that and then call createIndex()
just as you would with the regular node driver.– Neil Lunn
Nov 13 '18 at 12:27
I'm using feathers-mongodb. Where should this "createIndex()" be done?
– Jordi Blanch
Nov 13 '18 at 12:36
I'm using feathers-mongodb. Where should this "createIndex()" be done?
– Jordi Blanch
Nov 13 '18 at 12:36
So it should basically be something like
service('service-name').Model.createIndex( ... )
with all the regular createIndex()
options for your compound index. The adapter is nothing special and the Model
property is simply a Collection
object as already mentioned.– Neil Lunn
Nov 13 '18 at 12:39
So it should basically be something like
service('service-name').Model.createIndex( ... )
with all the regular createIndex()
options for your compound index. The adapter is nothing special and the Model
property is simply a Collection
object as already mentioned.– Neil Lunn
Nov 13 '18 at 12:39
Hello Neil, sorry for bothering you again, but in my last question I meant where in the FeathersJS file structure should this be done? I've tried in "servicename.service.js" file, after the service sets the Model field of service variable, but it seems not to be working for me. Do you know exactly where in the FeathersJS file structure should it be done? Thanks!
– Jordi Blanch
Nov 13 '18 at 15:13
Hello Neil, sorry for bothering you again, but in my last question I meant where in the FeathersJS file structure should this be done? I've tried in "servicename.service.js" file, after the service sets the Model field of service variable, but it seems not to be working for me. Do you know exactly where in the FeathersJS file structure should it be done? Thanks!
– Jordi Blanch
Nov 13 '18 at 15:13
Hello again... I was not defining correctly the compound index, now it is working, but I'm still wondering whether the place I've called the "createIndex()" is "FeathersJS compliant" or it should be done anywhere else not to break the FeathersJS intended flow...
– Jordi Blanch
Nov 13 '18 at 15:48
Hello again... I was not defining correctly the compound index, now it is working, but I'm still wondering whether the place I've called the "createIndex()" is "FeathersJS compliant" or it should be done anywhere else not to break the FeathersJS intended flow...
– Jordi Blanch
Nov 13 '18 at 15:48
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53280897%2ffeathersjs-create-compound-index-for-collection%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53280897%2ffeathersjs-create-compound-index-for-collection%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are you using
feathers-mongodb
orfeathers-mongoose
? They would have different ways of approaching it. AFAIK the plainfeathers-mongodb
simply allows you to return theCollection
object from the registered service. So you would just do that and then callcreateIndex()
just as you would with the regular node driver.– Neil Lunn
Nov 13 '18 at 12:27
I'm using feathers-mongodb. Where should this "createIndex()" be done?
– Jordi Blanch
Nov 13 '18 at 12:36
So it should basically be something like
service('service-name').Model.createIndex( ... )
with all the regularcreateIndex()
options for your compound index. The adapter is nothing special and theModel
property is simply aCollection
object as already mentioned.– Neil Lunn
Nov 13 '18 at 12:39
Hello Neil, sorry for bothering you again, but in my last question I meant where in the FeathersJS file structure should this be done? I've tried in "servicename.service.js" file, after the service sets the Model field of service variable, but it seems not to be working for me. Do you know exactly where in the FeathersJS file structure should it be done? Thanks!
– Jordi Blanch
Nov 13 '18 at 15:13
Hello again... I was not defining correctly the compound index, now it is working, but I'm still wondering whether the place I've called the "createIndex()" is "FeathersJS compliant" or it should be done anywhere else not to break the FeathersJS intended flow...
– Jordi Blanch
Nov 13 '18 at 15:48