1

I'm experiencing a strange problem in Mongoose related to find queries. When I run the query below, I get a variable number of results. I will get a consistent 210 results when querying in Mongo, but usually get between 198-210 results when doing the same thing through Mongoose. I've tried the query with and without indexes set.

Any suggestions on what might be causing this would be greatly appreciated.

Customer Model:

subscriptions: [ { renewal: { type: Boolean, default: false } } ] 

Query

Customer.find({ "subscriptions.renewal": true }, {}, { timeout: false }) 
4
  • renewal: type: Boolean default: false is not proper JavaScript as far as I know. you seem to be mussing {} Commented Jun 6, 2016 at 22:34
  • You are correct, I forgot to convert the example from coffeescript. I'll fix that. Commented Jun 6, 2016 at 22:41
  • Possible duplicate: stackoverflow.com/questions/23283308/… Commented Jun 6, 2016 at 23:28
  • Thanks leroydev. That issue is a bit different, but after reading it I tried deleting my indexes and that seems to have fixed the problem. I'll post that as the solution once I'm sure I know all of the details. Commented Jun 7, 2016 at 16:42

1 Answer 1

1

The problem ultimately cleared up when I removed the Customer collection indexes from Mongo (not just the definitions in the schema). Anyone experiencing this issue might want to give that a try.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.